1.14.4 #3
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: | |
release: | |
types: [published] | |
env: | |
CHART_FILE: "charts/mongodb-profiler-exporter/Chart.yaml" | |
RELEASE_TAG: "${{ github.event.release.tag_name }}" | |
jobs: | |
release: | |
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions | |
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check Tag | |
id: check-tag | |
run: | | |
if [[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "match=true" >> $GITHUB_ENV | |
else | |
echo "match=false" >> $GITHUB_ENV | |
fi | |
- name: Update version in Chart.yaml | |
if: env.match == 'true' | |
run: | | |
sed -i.bak "s/^version: .*/version: ${RELEASE_TAG}/" "$CHART_FILE" | |
sed -i.bak "s/^appVersion: .*/appVersion: ${RELEASE_TAG}/" "$CHART_FILE" | |
- name: Commit and push changes | |
if: env.match == 'true' | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
git add "${CHART_FILE}" | |
git commit -m "Update version to ${RELEASE_TAG}" | |
git push origin HEAD:main" | |
- name: Install Helm | |
uses: azure/setup-helm@v4 | |
if: env.match == 'true' | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
if: env.match == 'true' | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |