Skip to content

Commit 0414cb1

Browse files
committed
update release.yml
1 parent 004e689 commit 0414cb1

1 file changed

Lines changed: 43 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
name: "Release Build"
22

33
on:
4-
# Trigger ONLY when a tag is pushed (e.g., v1.2.3)
54
push:
65
tags:
76
- "v*"
8-
# Optional: also allow manual trigger
97
workflow_dispatch:
108

119
permissions:
1210
packages: write
1311
contents: write
1412

13+
env:
14+
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/beacon
15+
1516
jobs:
1617
build:
1718
runs-on: ${{ matrix.runner }}
1819
strategy:
1920
matrix:
20-
platform: [linux/amd64, linux/arm64]
2121
include:
2222
- platform: linux/amd64
23+
arch: amd64
2324
runner: ubuntu-24.04
2425
- platform: linux/arm64
26+
arch: arm64
2527
runner: ubuntu-24.04-arm
2628

2729
steps:
@@ -40,15 +42,12 @@ jobs:
4042
username: ${{ github.actor }}
4143
password: ${{ secrets.GITHUB_TOKEN }}
4244

43-
- name: Extract tag name (version)
44-
id: tag
45-
run: |
46-
VERSION=${GITHUB_REF#refs/tags/}
47-
echo "VERSION_TAG=${VERSION}" >> $GITHUB_ENV
45+
- name: Extract version
46+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
4847

4948
- name: Log version tag
5049
run: |
51-
echo "Building release version: ${{ env.VERSION_TAG }}"
50+
echo "Building release version: ${{ env.VERSION }}"
5251
5352
- name: Build and Push Docker Image
5453
uses: docker/build-push-action@v3
@@ -57,5 +56,38 @@ jobs:
5756
push: true
5857
platforms: ${{ matrix.platform }}
5958
tags: |
60-
ghcr.io/${{ github.repository_owner }}/beacon:${{ env.VERSION_TAG }}
61-
ghcr.io/${{ github.repository_owner }}/beacon:latest
59+
${{ env.IMAGE_NAME }}:${{ env.VERSION }}-${{ matrix.arch }}
60+
${{ env.IMAGE_NAME }}:latest-${{ matrix.arch }}
61+
62+
manifest:
63+
name: Create multi-arch manifest
64+
needs: build
65+
runs-on: ubuntu-24.04
66+
67+
steps:
68+
- name: Login to GHCR
69+
uses: docker/login-action@v3
70+
with:
71+
registry: ghcr.io
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Create and push manifest
76+
run: |
77+
docker manifest create \
78+
${{ env.IMAGE_NAME }}:${VERSION} \
79+
${{ env.IMAGE_NAME }}:${VERSION}-amd64 \
80+
${{ env.IMAGE_NAME }}:${VERSION}-arm64
81+
82+
docker manifest push \
83+
${{ env.IMAGE_NAME }}:${VERSION}
84+
85+
- name: Update latest tag
86+
run: |
87+
docker manifest create \
88+
${{ env.IMAGE_NAME }}:latest \
89+
${{ env.IMAGE_NAME }}:${VERSION}-amd64 \
90+
${{ env.IMAGE_NAME }}:${VERSION}-arm64
91+
92+
docker manifest push \
93+
${{ env.IMAGE_NAME }}:latest

0 commit comments

Comments
 (0)