Merge pull request #627 from cybozu-go/bump-chart-v0.10.0 #18
Workflow file for this run
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: Release Charts | |
on: | |
push: | |
tags: | |
- 'chart-v*' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.10.2 | |
- name: Check chart version | |
run: | | |
tag_version=${GITHUB_REF##*/chart-v} | |
chart_version=$(cat charts/moco/Chart.yaml | grep 'version:' | sed 's/version:\s//') | |
if [ "$tag_version" != "$chart_version" ]; then | |
echo "Different versions: tag \"$tag_version\", chart \"$chart_version\"" | |
exit 1 | |
fi | |
- name: Packaging the chart | |
run: helm package ./charts/moco/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: helm-charts | |
path: ./moco-*.tgz | |
retention-days: 1 | |
publish: | |
name: Publish charts on GitHub Pages | |
runs-on: ubuntu-20.04 | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.10.2 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: helm-charts | |
- name: Update charts index | |
run: helm repo index --url https://cybozu-go.github.io/moco/ --merge index.yaml . | |
- run: git add . | |
- name: Check diffs | |
run: | | |
diffs=$(git status -s) | |
if [ "$diffs" = "" ]; then | |
echo "NO_DIFF=1" >> $GITHUB_ENV | |
else | |
printf "%s\n" "$diffs" | |
fi | |
- name: Commit changes | |
if: env.NO_DIFF != '1' | |
run: | | |
git config --global user.name 'Cybozu Neco' | |
git config --global user.email 'cybozu-neco@users.noreply.github.com' | |
git commit -m 'update' | |
- name: Push to gh-pages | |
if: env.NO_DIFF != '1' | |
run: git push origin gh-pages |