-
Notifications
You must be signed in to change notification settings - Fork 773
242 lines (210 loc) · 8.04 KB
/
release.yml
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: Release Charts
on:
push:
branches:
- master
env:
tag_prefix: v
crds_tag_prefix: crds_v
jobs:
test:
uses: "traefik/traefik-helm-chart/.github/workflows/test.yml@master"
traefik:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git config --global --add safe.directory /charts
- name: Copy LICENSE, EXAMPLES.md and README.md for packaging
run: |
cp ./README.md ./traefik/README.md
cp ./EXAMPLES.md ./traefik/EXAMPLES.md
cp ./LICENSE ./traefik/LICENSE
- name: Generate default static install
run: |
kustomize build traefik-crds > traefik.yaml
helm template traefik ./traefik -n traefik >> traefik.yaml
- name: Get chart version
id: chart_version
run: |
echo "CHART_VERSION=$(cat traefik/Chart.yaml | awk -F"[ ',]+" '/version:/{print $2}' | head -n 1)" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: tag_exists
run: |
TAG_EXISTS=false
if git tag -l | grep "${{ env.tag_prefix }}${{ steps.chart_version.outputs.CHART_VERSION }}" > /dev/null ; then
TAG_EXISTS=true
fi
echo TAG_EXISTS=$TAG_EXISTS >> $GITHUB_OUTPUT
- name: Get Previous tag
id: previous_tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
prefix: v
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Tag release
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.chart_version.outputs.CHART_VERSION }}
tag_prefix: ${{ env.tag_prefix }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Render changelog configuration
env:
REGEXP: '(\\(.+\\)|(?!\\(CRDs-.+\\)))'
run: |
export DATE=$(date +%F); cat .github/workflows/changelog.json | envsubst > /tmp/changelog.json; cat /tmp/changelog.json
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Build Changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
fromTag: ${{ steps.previous_tag.outputs.tag }}
toTag: ${{ steps.tag_version.outputs.new_tag }}
configuration: "/tmp/changelog.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Create release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.changelog.outputs.changelog }}
prerelease: ${{ contains(steps.chart_version.outputs.CHART_VERSION, '-') }}
artifacts: "traefik.yaml"
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
# avoid to push both charts
- name: Delete traefik-crds chart
run: |
rm -rf traefik-crds
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.CHARTS_TOKEN }}
charts_dir: .
charts_url: https://traefik.github.io/charts
owner: traefik
repository: charts
branch: master
target_dir: traefik
index_dir: .
commit_username: traefiker
commit_email: [email protected]
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Publish Helm chart to the ghcr.io registry
uses: appany/[email protected]
with:
name: traefik
repository: traefik/helm
tag: ${{ steps.chart_version.outputs.CHART_VERSION }}
path: ./traefik
registry: ghcr.io
registry_username: traefiker
registry_password: ${{ secrets.GHCR_TOKEN }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
traefik-crds:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git config --global --add safe.directory /charts
- name: Copy LICENSE for packaging
run: |
cp ./LICENSE ./traefik/LICENSE
- name: Get chart version
id: chart_version
run: |
echo "CHART_VERSION=$(cat traefik-crds/Chart.yaml | awk -F"[ ',]+" '/version:/{print $2}' | head -n 1)" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: tag_exists
run: |
TAG_EXISTS=false
if git tag -l | grep "${{ env.crds_tag_prefix }}${{ steps.chart_version.outputs.CHART_VERSION }}" > /dev/null ; then
TAG_EXISTS=true
fi
echo TAG_EXISTS=$TAG_EXISTS >> $GITHUB_OUTPUT
- name: Get Previous tag
id: previous_tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
prefix: crds_v
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Tag release
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.chart_version.outputs.CHART_VERSION }}
tag_prefix: ${{ env.crds_tag_prefix }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Render changelog configuration
env:
REGEXP: '\\((CRDs|CRDs-.+)\\)'
run: |
export DATE=$(date +%F); cat .github/workflows/changelog.json | envsubst > /tmp/changelog.json; cat /tmp/changelog.json
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Build Changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
fromTag: ${{ steps.previous_tag.outputs.tag }}
toTag: ${{ steps.tag_version.outputs.new_tag }}
configuration: "/tmp/changelog.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Create release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.changelog.outputs.changelog }}
prerelease: ${{ contains(steps.chart_version.outputs.CHART_VERSION, '-') }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
# avoid to push both charts
- name: Delete traefik chart
run: |
rm -rf traefik
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.CHARTS_TOKEN }}
charts_dir: .
charts_url: https://traefik.github.io/charts
owner: traefik
repository: charts
branch: master
target_dir: traefik-crds
index_dir: .
commit_username: traefiker
commit_email: [email protected]
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'
- name: Publish Helm chart to the ghcr.io registry
uses: appany/[email protected]
with:
name: traefik-crds
repository: traefik/helm
tag: ${{ steps.chart_version.outputs.CHART_VERSION }}
path: ./traefik-crds
registry: ghcr.io
registry_username: traefiker
registry_password: ${{ secrets.GHCR_TOKEN }}
if: steps.tag_exists.outputs.TAG_EXISTS == 'false'