chore: Update Discord link (#14) #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push Docker image | |
on: | |
push: | |
branches: [ "main" ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-push-image: | |
name: Build and push Docker image | |
runs-on: [matterlabs-ci-runner] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set outputs | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Login to GAR | |
run: | | |
gcloud auth configure-docker us-docker.pkg.dev -q | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Generate build ID for Flux Image Automation | |
id: set_version | |
run: | | |
if [[ ${{ github.ref }} =~ "refs/tags" ]]; then | |
echo "image_tag_suffix=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
else | |
sha=$(git rev-parse --short HEAD) | |
ts=$(date +%s%N | cut -b1-13) | |
echo "image_tag_suffix=${sha}-${ts}" >> $GITHUB_OUTPUT | |
fi | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build_push_tag | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: docker/Dockerfile | |
push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }} | |
tags: | | |
"matterlabs/zksync-bft:latest" | |
"matterlabs/zksync-bft:${{ steps.set_version.outputs.image_tag_suffix }}" | |
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/zksync-bft:latest" | |
"us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/zksync-bft:${{ steps.set_version.outputs.image_tag_suffix }}" | |
- name: Print image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |