Skip to content

Update Chart version on Release #2

Update Chart version on Release

Update Chart version on Release #2

name: Update Chart version on Release
on:
release:
types: [published]
env:
CHART_FILE: "charts/mongodb-profiler-exporter/Chart.yaml"
RELEASE_TAG: "${{ github.event.release.tag_name }}"
jobs:
update-chart-appversion:
runs-on: ubuntu-latest
if: github.event.release.tag_name =~ '^[0-9]+\\.[0-9]+\\.[0-9]+$'

Check failure on line 14 in .github/workflows/update-chart-version.yml

View workflow run for this annotation

GitHub Actions / Update Chart version on Release

Invalid workflow file

The workflow is not valid. .github/workflows/update-chart-version.yml (Line: 14, Col: 9): Unexpected symbol: '=~'. Located at position 31 within expression: github.event.release.tag_name =~ '^[0-9]+\\.[0-9]+\\.[0-9]+$'
steps:
- name: Checkout repository
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 appVersion 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 Actions"
git config user.email "[email protected]"
git add "${CHART_FILE}"
git commit -m "Update appVersion to ${RELEASE_TAG}"
git push origin HEAD:main