-
Notifications
You must be signed in to change notification settings - Fork 18
131 lines (122 loc) · 4.29 KB
/
release.yaml
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: release
on:
workflow_dispatch:
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build-push-services:
permissions:
actions: read
contents: write
packages: write
id-token: write
strategy:
matrix:
destination: [ghcr, prod]
arch: [amd64, arm64]
include:
- destination: ghcr
registry: ghcr.io
username: ${{ github.actor }}
password: GITHUB_TOKEN
image: GHCR_IMAGE
secret_registry: false
- destination: prod
registry: REGISTRY_ENDPOINT
username: REGISTRY_USERNAME
password: REGISTRY_PASSWORD
image: REGISTRY_IMAGE
secret_registry: true
name: Release
uses: ./.github/workflows/release-workflow.yml
with:
password: ${{ matrix.password }}
username: ${{ matrix.username }}
registry: ${{ matrix.registry }}
tag: ${{ github.ref_name }}
arch: ${{ matrix.arch }}
image: ${{ matrix.image }}
secret_registry: ${{ matrix.secret_registry }}
secrets: inherit
multiarch:
name: Publish multiarch image
needs: [build-push-services]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
strategy:
matrix:
destination: [ghcr, prod]
include:
- destination: ghcr
registry: ghcr.io
username: ${{ github.actor }}
password: GITHUB_TOKEN
image: GHCR_IMAGE
secret_registry: false
- destination: prod
registry: REGISTRY_ENDPOINT
username: REGISTRY_USERNAME
password: REGISTRY_PASSWORD
image: REGISTRY_IMAGE
secret_registry: true
steps:
- name: Checkout
uses: actions/checkout@v4.1.3
with:
fetch-depth: 0
- name: Docker login
uses: docker/login-action@v3
with:
registry: ${{ matrix.secret_registry && secrets[matrix.registry] || matrix.registry }}
username: ${{ matrix.secret_registry && secrets[matrix.username] || matrix.username }}
password: ${{ secrets[matrix.password] }}
- name: Publish multiarch
run: CONTROLLER_IMG=${{ vars[matrix.image] }} TAG=${{ github.ref_name }} make docker-push-manifest-rancher-turtles
release:
name: Create helm release
needs: [multiarch]
runs-on: ubuntu-latest
env:
TAG: ${{ github.ref_name }}
CONTROLLER_IMG: ${{ vars.REGISTRY_IMAGE }}
PROD_REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
PROD_ORG: rancher
RELEASE_DIR: .cr-release-packages
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
steps:
- name: Checkout
uses: actions/checkout@v4.1.3
with:
fetch-depth: 0
- name: setupGo
uses: actions/setup-go@v5
with:
go-version: '=1.22.0'
- name: Get prod multiarch image digest
run: |
docker pull ${{ env.CONTROLLER_IMG }}:${{ env.TAG }}
multiarch_digest=$( docker inspect --format='{{index .RepoDigests 0}}' ${{ env.CONTROLLER_IMG }}:${{ env.TAG }} | sed 's/.*@//' )
echo "multiarch_digest=${multiarch_digest}" >> $GITHUB_ENV
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Package operator chart
run: RELEASE_TAG=${GITHUB_REF##*/} CONTROLLER_IMAGE_VERSION=${{ env.multiarch_digest }} CHART_PACKAGE_DIR=${RELEASE_DIR} REGISTRY=${{ env.PROD_REGISTRY }} ORG=${{ env.PROD_ORG }} make release
- name: Install chart-releaser
uses: helm/chart-releaser-action@v1.6.0
with:
install_only: true
- name: Prepare environment for the chart releaser
run: |
echo "CR_OWNER=$(cut -d '/' -f 1 <<< $GITHUB_REPOSITORY)" >> $GITHUB_ENV
echo "CR_GIT_REPO=$(cut -d '/' -f 2 <<< $GITHUB_REPOSITORY)" >> $GITHUB_ENV
rm -rf .cr-index
mkdir -p .cr-index
- name: Run chart-releaser upload
run: cr upload --skip-existing -c "$(git rev-parse HEAD)" --generate-release-notes --release-name-template "${{ env.TAG }}" --make-release-latest=false
- name: Run chart-releaser index
run: cr index --push --release-name-template "${{ env.TAG }}"