fixed build badge #3
This file contains hidden or 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 | |
on: | |
push: | |
branches: | |
# all branches, docker image is only pushed on main | |
- "*" | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
pull_request: | |
env: | |
SERVICE_ACCOUNT: [email protected] | |
DOCKER_REGISTRY: europe-west1-docker.pkg.dev/randamu-prod/candyland | |
IMAGE_MAINTAINER: "Randamu" | |
IMAGE_VENDOR: "Randamu" | |
jobs: | |
build-and-push: | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'true' | |
- name: Update submodules | |
run: git submodule update --init --recursive --remote | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '>=22.5.0' | |
- name: Login to Artifact Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: europe-west1-docker.pkg.dev | |
username: _json_key | |
password: ${{ secrets.GCP_SERVICE_ACCOUNT_TOKEN }} | |
- name: Install | |
run: npm install && npm install -g yarn | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Build | |
run: yarn build | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.DOCKER_REGISTRY }}/blocklock-agent | |
labels: | | |
maintainer=${{ env.IMAGE_MAINTAINER }} | |
org.opencontainers.image.title=blocklock-agent | |
org.opencontainers.image.description="an agent for uploading signatures to blockchains" | |
org.opencontainers.image.vendor=${{ env.IMAGE_VENDOR }} | |
flavor: | | |
latest=false | |
prefix= | |
suffix= | |
tags: | | |
type=sha,prefix= | |
type=ref,event=branch,suffix=-latest,enable=${{ startsWith(github.ref, 'refs/heads/') }} | |
type=semver,pattern={{version}},event=tag,enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
# this might not work at all, but might work and | |
# allow us to bypass dockerhub ratelimit | |
buildkitd-config-inline: | | |
[registry."docker.io"] | |
mirrors = ["mirror.gcr.io"] | |
## this does work to avoid the dockerhub ratelimit | |
driver-opts: | | |
image=mirror.gcr.io/moby/buildkit:buildx-stable-1 | |
network=host | |
- id: docker-push-tagged | |
name: Tag Docker image and push to Google Artifact Registry | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ github.ref == 'refs/heads/main' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: | | |
type=registry,ref=${{ env.DOCKER_REGISTRY }}/blocklock-agent-cache:${{ steps.meta.outputs.version }} | |
type=registry,ref=${{ env.DOCKER_REGISTRY }}/blocklock-agent-cache:main-latest | |
cache-to: type=registry,ref=${{ env.DOCKER_REGISTRY }}/blocklock-agent-cache:${{ steps.meta.outputs.version }},mode=max | |