forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 2
116 lines (107 loc) · 3.76 KB
/
release.yml
File metadata and controls
116 lines (107 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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