Skip to content

Commit 24c7283

Browse files
author
gurghet
committed
fix: add steps to publish helm chart to github pages
1 parent 3185c5b commit 24c7283

1 file changed

Lines changed: 58 additions & 1 deletion

File tree

.github/workflows/release.yaml

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,64 @@ jobs:
9090
cache-to: type=gha,mode=max
9191

9292
release-chart:
93-
needs: [release, build-and-push]
93+
needs: release
94+
if: needs.release.outputs.new_release_published == 'true'
95+
runs-on: ubuntu-latest
96+
permissions:
97+
contents: write
98+
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
103+
- name: Configure Git
104+
run: |
105+
git config user.name "$GITHUB_ACTOR"
106+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
107+
108+
- name: Install Helm
109+
uses: azure/setup-helm@v3
110+
with:
111+
version: v3.12.1
112+
113+
- name: Package Helm chart
114+
run: |
115+
mkdir -p .cr-release-packages
116+
helm package charts/github-deploy-key-operator --version ${{ needs.release.outputs.new_release_version }} --destination .cr-release-packages
117+
118+
- name: Upload Helm chart
119+
uses: actions/upload-artifact@v3
120+
with:
121+
name: helm-chart
122+
path: .cr-release-packages/*.tgz
123+
124+
- name: Download previous charts
125+
run: |
126+
git checkout gh-pages || git checkout --orphan gh-pages
127+
git rm -rf . || true
128+
git clean -fxd
129+
mkdir -p charts
130+
131+
- name: Download chart artifact
132+
uses: actions/download-artifact@v3
133+
with:
134+
name: helm-chart
135+
path: charts
136+
137+
- name: Generate Helm repo index
138+
run: |
139+
helm repo index charts/
140+
cp charts/index.yaml index.yaml
141+
142+
- name: Push to gh-pages
143+
run: |
144+
git add charts/
145+
git add index.yaml
146+
git commit -m "chore: publish helm chart ${{ needs.release.outputs.new_release_version }}"
147+
git push origin gh-pages -f
148+
149+
publish-chart:
150+
needs: release-chart
94151
if: needs.release.outputs.new_release_published == 'true'
95152
runs-on: ubuntu-latest
96153
permissions:

0 commit comments

Comments
 (0)