From b95caa3fba18ba6a2e7f43c4e8135af6ad38acf3 Mon Sep 17 00:00:00 2001 From: Alessandro Tagliapietra <0xalex88@proton.me> Date: Sat, 3 Feb 2024 19:44:17 -0800 Subject: [PATCH] Add CI --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ docker-bake.hcl | 30 ++++++++++----------- 2 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..c36b00afca --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release docker image + +on: + workflow_dispatch: + inputs: + service: + description: Service to release + required: true + type: choice + options: + - op-node + - op-batcher + - op-proposer + version: + description: Service version to publish (will be the docker tag) + required: true + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/bake-action@v4 + env: + REGISTRY: ghcr.io + REPOSITORY: fraxfinance/fraxtal + PLATFORMS: linux/amd64,linux/arm64 + GIT_COMMIT: ${{ github.sha }} + GIT_VERSION: ${{ inputs.version }} + IMAGE_TAGS: ${{ inputs.version }} + with: + push: true + set: | + *.cache-from=type=gha + *.cache-to=type=gha,mode=max + targets: ${{ inputs.service }} diff --git a/docker-bake.hcl b/docker-bake.hcl index 279d0d2bd5..9be78493f0 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -38,7 +38,7 @@ target "op-stack-go" { GIT_DATE = "${GIT_DATE}" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-stack-go:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-stack-go:${tag}"] } target "op-node" { @@ -51,7 +51,7 @@ target "op-node" { op-stack-go: "target:op-stack-go" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-node:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-node:${tag}"] } target "op-batcher" { @@ -64,7 +64,7 @@ target "op-batcher" { op-stack-go: "target:op-stack-go" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-batcher:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-batcher:${tag}"] } target "op-proposer" { @@ -77,7 +77,7 @@ target "op-proposer" { op-stack-go: "target:op-stack-go" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-proposer:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-proposer:${tag}"] } target "op-challenger" { @@ -90,7 +90,7 @@ target "op-challenger" { op-stack-go: "target:op-stack-go" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-challenger:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-challenger:${tag}"] } target "op-conductor" { @@ -103,7 +103,7 @@ target "op-conductor" { op-stack-go: "target:op-stack-go" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-conductor:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-conductor:${tag}"] } target "op-heartbeat" { @@ -116,7 +116,7 @@ target "op-heartbeat" { op-stack-go: "target:op-stack-go" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-heartbeat:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-heartbeat:${tag}"] } target "op-program" { @@ -129,7 +129,7 @@ target "op-program" { op-stack-go: "target:op-stack-go" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-program:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-program:${tag}"] } target "op-ufm" { @@ -142,7 +142,7 @@ target "op-ufm" { GITVERSION = "${GIT_VERSION}" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/op-ufm:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-op-ufm:${tag}"] } target "proxyd" { @@ -155,7 +155,7 @@ target "proxyd" { GITVERSION = "${GIT_VERSION}" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/proxyd:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-proxyd:${tag}"] } target "indexer" { @@ -168,7 +168,7 @@ target "indexer" { GITVERSION = "${GIT_VERSION}" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/indexer:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-indexer:${tag}"] } target "ufm-metamask" { @@ -181,7 +181,7 @@ target "ufm-metamask" { GITVERSION = "${GIT_VERSION}" } platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/ufm-metamask:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-ufm-metamask:${tag}"] } target "chain-mon" { @@ -196,14 +196,14 @@ target "chain-mon" { // this is a multi-stage build, where each stage is a possible output target, but wd-mon is all we publish target = "wd-mon" platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/chain-mon:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-chain-mon:${tag}"] } target "ci-builder" { dockerfile = "./ops/docker/ci-builder/Dockerfile" context = "." platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/ci-builder:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-ci-builder:${tag}"] } target "contracts-bedrock" { @@ -211,5 +211,5 @@ target "contracts-bedrock" { context = "." target = "contracts-bedrock" platforms = split(",", PLATFORMS) - tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}/contracts-bedrock:${tag}"] + tags = [for tag in split(",", IMAGE_TAGS) : "${REGISTRY}/${REPOSITORY}-contracts-bedrock:${tag}"] }