-
Notifications
You must be signed in to change notification settings - Fork 17
162 lines (154 loc) · 4.66 KB
/
nightly-test-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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Test release process nightly
on:
schedule:
- cron: "0 0 * * *" # Run every day at midnight (UTC)
workflow_dispatch: # Allow running manually on demand
env:
RELEASE_TAG: t9.9.9-fake
jobs:
nightly-test-release:
name: Tag current version for testing
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/[email protected]
with:
ref: main
fetch-depth: 0
- name: Set and push fake tag for release
run: |
git tag ${{ env.RELEASE_TAG }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
tags: true
github_token: ${{ secrets.GITHUB_TOKEN }}
build-push-services:
name: Build, sign and provenance
needs: [nightly-test-release]
permissions:
actions: read
contents: write
packages: write
id-token: write
strategy:
matrix:
destination: [ghcr]
arch: [amd64, arm64]
include:
- destination: ghcr
registry: ghcr.io
username: ${{ github.actor }}
password: GITHUB_TOKEN
image: GHCR_IMAGE
secret_registry: false
uses: ./.github/workflows/release-workflow.yml
with:
password: ${{ matrix.password }}
username: ${{ matrix.username }}
registry: ${{ matrix.registry }}
tag: t9.9.9-fake
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]
include:
- destination: ghcr
registry: ghcr.io
username: ${{ github.actor }}
password: GITHUB_TOKEN
image: GHCR_IMAGE
secret_registry: false
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ env.RELEASE_TAG }}
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=${{ env.RELEASE_TAG }} make docker-push-manifest-rancher-turtles
release:
name: Create helm release
needs: [build-push-services]
runs-on: ubuntu-latest
env:
PROD_REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }}
PROD_ORG: rancher
RELEASE_DIR: .cr-release-packages
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ env.RELEASE_TAG }}
fetch-depth: 0
- name: setupGo
uses: actions/setup-go@v5
with:
go-version: '=1.22.0'
- name: Package operator chart
run: RELEASE_TAG=${{ env.RELEASE_TAG }} CHART_PACKAGE_DIR=${RELEASE_DIR} REGISTRY=${{ env.PROD_REGISTRY }} ORG=${{ env.PROD_ORG }} make release
notify-failure:
name: Notify failure in Slack
needs: [release]
if: ${{ failure() || cancelled() }}
runs-on: ubuntu-latest
steps:
- uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Rancher turtles RELEASE test failed."
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": ":github:",
"emoji": true
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
clean-up:
name: Release testing clean up
needs: [release]
if: always()
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: dev-drprasad/[email protected]
with:
tag_name: ${{ env.RELEASE_TAG }}
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: false