Skip to content

Commit

Permalink
fix: NVSHAS-9624 rewrite gh-page publish flow
Browse files Browse the repository at this point in the history
Per EIO team's requirement, rewrite how we publish helm repo

Also upgraded actions/checkout to v4
  • Loading branch information
holyspectral committed Nov 12, 2024
1 parent 3ddd337 commit 36d9cb0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/publish-on-tagging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,37 @@ name: Publish Charts on tagging

on:
push:
tags: '*'
tags: 'v*'

jobs:
publish:
runs-on: ubuntu-latest
env:
TAG: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
- name: Publish Helm charts
uses: becitsthere/helm-gh-pages@master
- uses: actions/checkout@v4
- name: Setup helm
uses: azure/[email protected]
with:
charts_dir: charts
helm_version: 3.2.0
token: ${{ secrets.HELM_PUBLISHER_TOKEN }}
version: v3.16.2
- name: Publish Helm charts
run: |
CHARTS_TMP_DIR=$(mktemp -d)
helm lint charts/core charts/crd charts/monitor
helm package charts/core charts/crd charts/monitor --destination ${CHARTS_TMP_DIR} --version ${TAG#v}
git clone https://x-access-token:${{ secrets.HELM_PUBLISHER_TOKEN }}@github.com/${{ github.repository_owner }}/${{ github.event.repository.name }} repo
cd repo/
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${{ secrets.HELM_PUBLISHER_TOKEN }}@github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}"
git checkout gh-pages
if [[ -f "index.yaml" ]]; then
FLAGS="--merge index.yaml"
fi
helm repo index ${CHARTS_TMP_DIR} --url https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} ${FLAGS}
mv -f ${CHARTS_TMP_DIR}/*.tgz ./
mv -f ${CHARTS_TMP_DIR}/index.yaml ./index.yaml
git add .
git commit -m "Publish ${{ github.ref_name }}"
git push origin gh-pages
16 changes: 0 additions & 16 deletions .github/workflows/publish.yaml

This file was deleted.

0 comments on commit 36d9cb0

Please sign in to comment.