Skip to content

based2

based2 #11

Workflow file for this run

name: Release Docker Images
on:
push:
tags:
- 'v*'
permissions:
contents: read
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-push:
strategy:
matrix:
platform:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
fail-fast: false
name: Build & Push op services (${{ matrix.platform.arch }})
runs-on: ${{ matrix.platform.runner }}
env:
IMAGE_REG: ghcr.io/gattaca-com/based-optimism
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: false
- uses: docker/setup-buildx-action@v3
with:
builder: multiarch-builder
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
run: |
# Extract tag name (remove refs/tags/ prefix)
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
# Extract git commit and date
GIT_COMMIT=$(git rev-parse HEAD)
GIT_DATE=$(git log -1 --format=%ct)
echo "git_commit=$GIT_COMMIT" >> $GITHUB_OUTPUT
echo "git_date=$GIT_DATE" >> $GITHUB_OUTPUT
- name: Build & Push op-node
run: |
IMAGE_TAGS=${{ steps.meta.outputs.tag_name }}-${{ matrix.platform.arch }},${{ !contains(github.ref_name, 'rc') && format('latest-{0}', matrix.platform.arch) || '' }} \
GIT_COMMIT=${{ steps.meta.outputs.git_commit }} \
GIT_DATE=${{ steps.meta.outputs.git_date }} \
GIT_VERSION=${{ steps.meta.outputs.tag_name }} \
REGISTRY=ghcr.io \
REPOSITORY=gattaca-com/based-optimism \
PLATFORMS=linux/${{ matrix.platform.arch == 'arm64' && 'arm64/v8' || matrix.platform.arch }} \
docker buildx bake \
-f docker-bake.hcl \
--push \
op-node
- name: Build & Push op-deployer
run: |
IMAGE_TAGS=${{ steps.meta.outputs.tag_name }}-${{ matrix.platform.arch }},${{ !contains(github.ref_name, 'rc') && format('latest-{0}', matrix.platform.arch) || '' }} \
GIT_COMMIT=${{ steps.meta.outputs.git_commit }} \
GIT_DATE=${{ steps.meta.outputs.git_date }} \
GIT_VERSION=${{ steps.meta.outputs.tag_name }} \
REGISTRY=ghcr.io \
REPOSITORY=gattaca-com/based-optimism \
PLATFORMS=linux/${{ matrix.platform.arch == 'arm64' && 'arm64/v8' || matrix.platform.arch }} \
docker buildx bake \
-f docker-bake.hcl \
--push \
op-deployer
create-manifest:
needs: build-and-push
runs-on: ubuntu-latest
strategy:
matrix:
image:
- op-node
- op-deployer
env:
IMAGE_REG: ghcr.io/${{ github.repository }}
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create & Push Multi-Arch Manifests
run: |
ghcr="ghcr.io/${{ github.repository }}"
tag="${{ github.ref_name }}"
name="${{ matrix.image }}"
# Use buildx imagetools to create multi-arch manifest
docker buildx imagetools create \
--tag $ghcr/based-$name:$tag \
$ghcr/$name:$tag-amd64 \
$ghcr/$name:$tag-arm64
if [[ ! "$tag" =~ "rc" ]]; then
docker buildx imagetools create \
--tag $ghcr/based-$name:latest \
$ghcr/$name:latest-amd64 \
$ghcr/$name:latest-arm64
fi