Update Chart version on Release #2
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: 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 GitHub Actions / Update Chart version on ReleaseInvalid workflow file
|
||
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 |