Build Via verifier #1
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 Via verifier | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: "Git reference (branch, commit, or tag) to build from" | |
type: string | |
required: false | |
image_tag_suffix: | |
description: "Optional suffix to override tag name generation" | |
type: string | |
required: false | |
jobs: | |
build-and-push: | |
name: Build and Push Docker Images | |
runs-on: [self-hosted, cpu] | |
steps: | |
- name: Set reference and fetch repo | |
run: | | |
if [[ -n "${{ inputs.ref }}" ]]; then | |
echo "REF=${{ inputs.ref }}" >> $GITHUB_ENV | |
else | |
REF="$(git rev-parse --abbrev-ref HEAD)" # Get the current branch if not provided | |
fi | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ env.REF }} | |
submodules: 'recursive' | |
- name: Determine Docker tag | |
run: | | |
if [[ -n "${{ inputs.image_tag_suffix }}" ]]; then | |
TAG="${{ inputs.image_tag_suffix }}" | |
else | |
TAG=$(git rev-parse --short HEAD) | |
fi | |
echo "DOCKER_TAG=$TAG" >> $GITHUB_ENV | |
- name: Setup env | |
run: | | |
echo VIA_HOME=$(pwd) >> $GITHUB_ENV | |
echo CI=1 >> $GITHUB_ENV | |
echo $(pwd)/bin >> $GITHUB_PATH | |
echo CI=1 >> .env | |
echo IN_DOCKER=1 >> .env | |
- name: Build contracts | |
run: | | |
via | |
yarn l2-contracts build | |
yarn workspace system-contracts build | |
- name: Build image | |
run: | | |
docker buildx build -t via-verifier:${{ env.DOCKER_TAG }} -f docker/via-verifier/Dockerfile . | |
- name: Publish image to registry | |
run: | | |
docker tag via-verifier:${{ env.DOCKER_TAG }} europe-west3-docker.pkg.dev/viaorg-prod-net-landing-0/via/via-verifier:${{ env.DOCKER_TAG }} | |
docker push europe-west3-docker.pkg.dev/viaorg-prod-net-landing-0/via/via-verifier:${{ env.DOCKER_TAG }} | |
echo "Image: europe-west3-docker.pkg.dev/viaorg-prod-net-landing-0/via/via-verifier:${{ env.DOCKER_TAG }}" |