version 0.2.0 for support mviewer and mviewerstudio #60
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Helm publish on new commit and new version | |
on: | |
push: | |
branches: | |
- 'main' | |
- '!gh-pages' | |
jobs: | |
chart-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Helm Installation | |
uses: azure/setup-helm@v3 | |
- name: Run chart-releaser for publish on new version | |
if: github.ref == 'refs/heads/main' | |
uses: helm/chart-releaser-action@main | |
with: | |
charts_dir: '.' | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: 'gh-pages' | |
path: gh-pages | |
- name: Helm Package all the charts using commit ID and remove chart packages older than 6 months | |
shell: bash | |
run: | | |
mv gh-pages /tmp/gh-pages | |
for directory in *; do | |
if [ -d "$directory" ]; then | |
helm package "$directory" -d /tmp/gh-pages --version $(helm show chart "$directory" |grep ^version: | awk '{print $2}')-"$GITHUB_REF_NAME"-"${GITHUB_SHA::7}" | |
fi | |
done | |
cd /tmp/gh-pages | |
find . -type f -mtime +180 -delete | |
helm repo index . --merge index.yaml | |
cd $GITHUB_WORKSPACE | |
mv /tmp/gh-pages . | |
- name: Deploy to GitHub Pages the charts based on the commit ID | |
uses: crazy-max/ghaction-github-pages@v3 | |
with: | |
target_branch: gh-pages | |
build_dir: gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |