Skip to content

Commit eedcf31

Browse files
chore(ci): automate publishing again (#398)
* Automate publishing again * Don't skip publishing for existing tags / releases * add comment * Rewrite release flow * Add script to update gh-pages manually * Fix dir reference * Fix dir reference * add git config * Maybe fix git push * Add URL for artifact * Don't include the binary itself * fix git add * re-add artifact * simplify diff * remove workflow dispatch
1 parent 02368cc commit eedcf31

File tree

1 file changed

+45
-15
lines changed

1 file changed

+45
-15
lines changed

.github/workflows/release.yaml

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
name: Release Charts
22

33
on:
4-
workflow_dispatch:
4+
push:
5+
tags:
6+
- flagsmith-*.*.*
7+
8+
env:
9+
HELM_VERSION: v3.12.3
510

611
jobs:
712
release:
813
runs-on: ubuntu-latest
14+
915
steps:
1016
- name: Checkout
11-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1218
with:
1319
fetch-depth: 0
1420

15-
- name: Configure Git
16-
run: |
17-
git config user.name "$GITHUB_ACTOR"
18-
git config user.email "[email protected]"
19-
2021
- name: Install Helm
21-
uses: azure/setup-helm@v1
22+
uses: azure/setup-helm@v3
2223
with:
23-
version: v3.5.4
24+
version: ${{ env.HELM_VERSION }}
2425

2526
- name: Add chart repo dependencies
2627
# Note: this repos should match with the repos set in ct.yaml
@@ -32,15 +33,44 @@ jobs:
3233
helm repo add bitnami https://charts.bitnami.com/bitnami
3334
3435
- name: Set up chart-testing
35-
uses: helm/chart-testing-action@v2.0.1
36+
uses: helm/chart-testing-action@v2
3637
with:
37-
version: v3.3.0
38+
version: ${{ env.HELM_VERSION }}
3839

3940
- name: Run chart-testing (lint)
4041
run: ct lint --config ct.yaml --lint-conf lintconf.yaml
4142

42-
- name: Run chart-releaser
43-
id: chart-releaser
44-
uses: helm/[email protected]
43+
# The following steps replace those originally handled by helm.chart-releaser-action
44+
# Now that release-please is handling the generation of the release and tag, we just need
45+
# to build the charts, upload them to the release created by release-please, and then
46+
# update the gh-pages branch to update the helm repo.
47+
48+
- name: Build chart
49+
run: |
50+
mkdir -p .cr-release-packages
51+
helm dependency update charts/flagsmith
52+
helm package charts/flagsmith --destination .cr-release-packages
53+
54+
- name: Upload chart to GitHub Release
55+
uses: softprops/action-gh-release@v1
56+
with:
57+
files: .cr-release-packages/*.tgz
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Update GitHub Pages index
62+
run: |
63+
git fetch origin gh-pages
64+
git worktree add gh-pages origin/gh-pages
65+
cp .cr-release-packages/*.tgz gh-pages/
66+
helm repo index gh-pages \
67+
--merge gh-pages/index.yaml \
68+
--url "https://github.com/Flagsmith/flagsmith-charts/releases/download/$GITHUB_REF_NAME"
69+
cd gh-pages
70+
git config user.name "flagsmithdev"
71+
git config user.email "[email protected]"
72+
git add index.yaml
73+
git commit -m "Add Helm chart for $GITHUB_REF_NAME"
74+
git push origin HEAD:gh-pages
4575
env:
46-
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)