-
Notifications
You must be signed in to change notification settings - Fork 41
51 lines (43 loc) · 1.61 KB
/
build_and_publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Build and publish era-withdrawal-finalizer image
on:
push:
tags:
- v*
jobs:
push_to_registry:
name: Build and push docker image
runs-on: [matterlabs-ci-runner]
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Set up Docker Build
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Generate build ID for Flux Image Automation
id: tag
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
echo "::set-output name=BUILD_ID::${GITHUB_REF#refs/*/}"
- name: Generate build ID for Flux Image Automation
id: build
if: ${{ !startsWith(github.ref, 'refs/tags') }}
run: |
sha=$(git rev-parse --short HEAD)
ts=$(date +%s%N | cut -b1-13)
echo "::set-output name=BUILD_ID::${sha}-${ts}"
- name: Auth to google artifact registry
run: |
gcloud auth configure-docker us-docker.pkg.dev -q
- name: Build and push Docker image
uses: docker/[email protected]
if: ${{ startsWith(github.ref, 'refs/tags') }}
with:
push: true
tags: |
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/era-withdrawal-finalizer:latest"
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/era-withdrawal-finalizer:${{ steps.tag.outputs.BUILD_ID }}"
file: Dockerfile
no-cache: true