Skip to content

Commit 2b91fbc

Browse files
syscod3claude
andcommitted
ci: release-please + multi-arch GHCR release workflow
- release-please: auto changelog + version bump on merge to main - release.yml: native amd64 + arm64 builds, multi-arch manifest merge to GHCR Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c6b2183 commit 2b91fbc

4 files changed

Lines changed: 114 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
actions: write
12+
13+
jobs:
14+
release-please:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: googleapis/release-please-action@v4
18+
id: release
19+
with:
20+
config-file: .release-please-config.json
21+
manifest-file: .release-please-manifest.json
22+
23+
- name: Trigger release build
24+
if: steps.release.outputs.release_created == 'true'
25+
uses: actions/github-script@v7
26+
with:
27+
script: |
28+
await github.rest.actions.createWorkflowDispatch({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
workflow_id: 'release.yml',
32+
ref: 'main',
33+
inputs: { tag: '${{ steps.release.outputs.tag_name }}' }
34+
})

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Tag to release (e.g. v1.2.3)"
8+
required: true
9+
10+
env:
11+
GO_VERSION: "1.25"
12+
REGISTRY: ghcr.io
13+
IMAGE: ghcr.io/syscode-labs/oci-pivot-controller
14+
15+
jobs:
16+
build-push:
17+
strategy:
18+
matrix:
19+
include:
20+
- arch: amd64
21+
runner: ubuntu-24.04
22+
- arch: arm64
23+
runner: ubuntu-24.04-arm
24+
runs-on: ${{ matrix.runner }}
25+
permissions:
26+
contents: read
27+
packages: write
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: docker/setup-buildx-action@v3
32+
33+
- uses: docker/login-action@v4
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
platforms: linux/${{ matrix.arch }}
43+
push: true
44+
tags: |
45+
${{ env.IMAGE }}:${{ inputs.tag }}-${{ matrix.arch }}
46+
${{ env.IMAGE }}:latest-${{ matrix.arch }}
47+
48+
merge-manifests:
49+
needs: build-push
50+
runs-on: ubuntu-24.04
51+
permissions:
52+
packages: write
53+
steps:
54+
- uses: docker/login-action@v4
55+
with:
56+
registry: ${{ env.REGISTRY }}
57+
username: ${{ github.actor }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Create multi-arch manifests
61+
run: |
62+
docker buildx imagetools create \
63+
-t ${{ env.IMAGE }}:${{ inputs.tag }} \
64+
${{ env.IMAGE }}:${{ inputs.tag }}-amd64 \
65+
${{ env.IMAGE }}:${{ inputs.tag }}-arm64
66+
docker buildx imagetools create \
67+
-t ${{ env.IMAGE }}:latest \
68+
${{ env.IMAGE }}:latest-amd64 \
69+
${{ env.IMAGE }}:latest-arm64

.release-please-config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "go",
5+
"include-v-in-tag": true
6+
}
7+
}
8+
}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.0"
3+
}

0 commit comments

Comments
 (0)