-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (91 loc) · 2.88 KB
/
release.yml
File metadata and controls
109 lines (91 loc) · 2.88 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
name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v1.2.3)"
required: true
env:
GO_VERSION: "1.25"
REGISTRY: ghcr.io
IMAGE: ghcr.io/syscode-labs/oci-pivot-controller
jobs:
build-push:
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build context note
run: echo "::notice title=Build context::Building linux/${{ matrix.arch }} on native runner ${{ matrix.runner }}."
- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/${{ matrix.arch }}
push: true
tags: |
${{ env.IMAGE }}:${{ github.event.release.tag_name || inputs.tag }}-${{ matrix.arch }}
${{ env.IMAGE }}:latest-${{ matrix.arch }}
merge-manifests:
needs: build-push
runs-on: ubuntu-24.04
permissions:
packages: write
steps:
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create multi-arch manifests
shell: bash
run: |
set -euo pipefail
TAG="${{ github.event.release.tag_name || inputs.tag }}"
docker buildx imagetools create \
-t ${{ env.IMAGE }}:${TAG} \
${{ env.IMAGE }}:${TAG}-amd64 \
${{ env.IMAGE }}:${TAG}-arm64
docker buildx imagetools create \
-t ${{ env.IMAGE }}:latest \
${{ env.IMAGE }}:latest-amd64 \
${{ env.IMAGE }}:latest-arm64
release-helm:
needs: merge-manifests
runs-on: ubuntu-24.04
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: azure/setup-helm@v4
- name: Log in to GHCR (Helm)
run: helm registry login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
- name: Package and push Helm chart
shell: bash
run: |
set -euo pipefail
TAG="${{ github.event.release.tag_name || inputs.tag }}"
CHART_VERSION="${TAG#v}"
helm package charts/oci-pivot-controller \
--version "${CHART_VERSION}" \
--app-version "${TAG}"
helm push "oci-pivot-controller-${CHART_VERSION}.tgz" \
oci://ghcr.io/syscode-labs/charts