Publish Helm Charts for version 4.5.1 (#147) #166
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 repository's main README file | |
on: | |
push: | |
branches: [main] | |
jobs: | |
README_UPDATE: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
# Fetching all branches here to get main and master. | |
fetch-depth: 0 | |
- name: Updating README | |
run: | | |
SHELL=/bin/bash | |
LATEST_VERSION="$(ls | grep -E '^[0-9]+(\.[0-9]+)*$' | sort --version-sort | tail -n 1)" | |
echo "LATEST VERSION is $LATEST_VERSION" | |
sed -i.bak -E 's@(Latest version: |Latest%20version-|\[Latest version\]: \./)[0-9]+(\.[0-9]+)*@\1'"$LATEST_VERSION"'@g' README.md | |
rm -f "README.md.bak" 2>/dev/null || true | |
rm -f latest 2>/dev/null || true | |
ln -s "./${LATEST_VERSION}/" latest | |
git add latest | |
if git diff --quiet HEAD; then | |
echo "No updates." | |
# Keep master in sync with main | |
git push origin HEAD:master | |
else | |
echo "Updated README and latest symlink" | |
git config --global user.name '${{ vars.RHACS_BOT_GITHUB_USERNAME }}' | |
git config --global user.email '${{ vars.RHACS_BOT_GITHUB_EMAIL }}' | |
git remote set-url origin https://x-access-token:${{ secrets.RHACS_BOT_GITHUB_TOKEN }}@github.com/"$GITHUB_REPOSITORY" | |
msg="Updated latest version reference to ${LATEST_VERSION}" | |
if grep -q "$msg" < <(git log -n 1 --pretty='format:%s'); then | |
echo "Latest version update already exists, but still changes detected!" | |
git diff HEAD | |
exit 1 | |
fi | |
git commit -am "$msg 🤖" | |
git push origin HEAD:main | |
# Keep master in sync with main | |
git push origin HEAD:master | |
fi | |
echo "✓ Done" |