Skip to content

Commit bdf5ee9

Browse files
fix: legacy release workflow running on >=v0.25 (#1916)
* fix: legacy release workflow running on >=v0.25 Signed-off-by: Carlos Salas <[email protected]> * feat: use separate helm chart release workflow Signed-off-by: Carlos Salas <[email protected]> --------- Signed-off-by: Carlos Salas <[email protected]>
1 parent 1eadd08 commit bdf5ee9

File tree

3 files changed

+94
-46
lines changed

3 files changed

+94
-46
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
tag:
5+
type: string
6+
description: Tag for the release
7+
required: true
8+
9+
org:
10+
type: string
11+
description: Organization part of the image name
12+
required: true
13+
14+
image:
15+
type: string
16+
description: Static image value for the build
17+
18+
release_dir:
19+
type: string
20+
description: Directory where release is stored
21+
default: .cr-release-packages
22+
23+
jobs:
24+
release:
25+
name: Create helm release
26+
runs-on: ubuntu-latest
27+
env:
28+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
29+
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v6
33+
with:
34+
fetch-depth: 0
35+
36+
- name: setupGo
37+
uses: actions/[email protected]
38+
with:
39+
go-version-file: go.mod
40+
41+
- name: Configure Git
42+
run: |
43+
git config user.name "$GITHUB_ACTOR"
44+
git config user.email "[email protected]"
45+
46+
- name: Package operator chart
47+
run: RELEASE_TAG=${GITHUB_REF##*/} CHART_PACKAGE_DIR=${{ inputs.release_dir }} CONTROLLER_IMG="${{ inputs.org }}/${{ inputs.image }}" ORG=${{ inputs.org }} make release
48+
49+
- name: Install chart-releaser
50+
uses: helm/[email protected]
51+
with:
52+
install_only: true
53+
54+
- name: Prepare environment for the chart releaser
55+
run: |
56+
echo "CR_OWNER=$(cut -d '/' -f 1 <<< $GITHUB_REPOSITORY)" >> $GITHUB_ENV
57+
echo "CR_GIT_REPO=$(cut -d '/' -f 2 <<< $GITHUB_REPOSITORY)" >> $GITHUB_ENV
58+
rm -rf .cr-index
59+
mkdir -p .cr-index
60+
61+
- name: Run chart-releaser upload
62+
run: cr upload --skip-existing -c "$(git rev-parse HEAD)" --generate-release-notes --release-name-template "${{ inputs.tag }}" --make-release-latest=false
63+
64+
- name: Run chart-releaser index
65+
run: cr index --push --release-name-template "${{ inputs.tag }}"

.github/workflows/release-v2.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ name: Turtles release
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
# This is just a temporary filter while we maintain two release workflows.
7+
# TODO: change to "v*" when this becomes the only one.
8+
- "v0.2[5-9].*"
9+
- "v0.[3-9]*"
10+
- "v[1-9]*"
711
workflow_dispatch:
812

913
permissions:
@@ -181,4 +185,15 @@ jobs:
181185
done
182186
183187
cat provenance-slsav1.json
184-
cosign attest --yes --predicate provenance-slsav1.json --type slsaprovenance1 "${MULTI_PLATFORM_IMAGE}"
188+
cosign attest --yes --predicate provenance-slsav1.json --type slsaprovenance1 "${MULTI_PLATFORM_IMAGE}"
189+
190+
chart-release:
191+
name: Helm chart release
192+
uses: ./.github/workflows/chart-release.yml
193+
needs:
194+
- merge
195+
with:
196+
tag: ${{ github.ref_name }}
197+
org: rancher
198+
image: turtles
199+
secrets: inherit

.github/workflows/release-workflow.yaml

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ on:
55
workflow_dispatch:
66
push:
77
tags:
8-
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
8+
# Will only match if `<v0.25.x`
9+
- "v0.[0-9].*"
10+
- "v0.1[0-9].*"
11+
- "v0.2[0-4].*"
912

1013
jobs:
1114
build-push-services:
@@ -44,47 +47,12 @@ jobs:
4447
secret_registry: ${{ matrix.secret_registry }}
4548
secrets: inherit
4649

47-
release:
48-
name: Create helm release
50+
chart-release:
51+
name: Helm chart release
52+
uses: ./.github/workflows/chart-release.yml
4953
needs: [build-push-services]
50-
runs-on: ubuntu-latest
51-
env:
52-
TAG: ${{ github.ref_name }}
53-
ORG: ${{ vars.RANCHER_ORG }}
54-
CONTROLLER_IMG: ${{ vars.IMAGE_NAME }}
55-
RELEASE_DIR: .cr-release-packages
56-
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
57-
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
58-
steps:
59-
- name: Checkout
60-
uses: actions/checkout@v6
61-
with:
62-
fetch-depth: 0
63-
- name: setupGo
64-
uses: actions/[email protected]
65-
with:
66-
go-version-file: go.mod
67-
- name: Configure Git
68-
run: |
69-
git config user.name "$GITHUB_ACTOR"
70-
git config user.email "[email protected]"
71-
- name: Package operator chart
72-
run: RELEASE_TAG=${GITHUB_REF##*/} CHART_PACKAGE_DIR=${RELEASE_DIR} CONTROLLER_IMG="${{ env.ORG }}/${{ env.CONTROLLER_IMG }}" ORG=${{ env.ORG }} make release
73-
74-
- name: Install chart-releaser
75-
uses: helm/[email protected]
76-
with:
77-
install_only: true
78-
79-
- name: Prepare environment for the chart releaser
80-
run: |
81-
echo "CR_OWNER=$(cut -d '/' -f 1 <<< $GITHUB_REPOSITORY)" >> $GITHUB_ENV
82-
echo "CR_GIT_REPO=$(cut -d '/' -f 2 <<< $GITHUB_REPOSITORY)" >> $GITHUB_ENV
83-
rm -rf .cr-index
84-
mkdir -p .cr-index
85-
86-
- name: Run chart-releaser upload
87-
run: cr upload --skip-existing -c "$(git rev-parse HEAD)" --generate-release-notes --release-name-template "${{ env.TAG }}" --make-release-latest=false
88-
89-
- name: Run chart-releaser index
90-
run: cr index --push --release-name-template "${{ env.TAG }}"
54+
with:
55+
tag: ${{ github.ref_name }}
56+
org: ${{ vars.RANCHER_ORG }}
57+
image: ${{ vars.IMAGE_NAME }}
58+
secrets: inherit

0 commit comments

Comments
 (0)