Skip to content

Commit

Permalink
Simplify updateversionfromchangelog
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor authored Apr 25, 2024
1 parent 63f56a7 commit 2286cee
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/updateversionfromchangelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,33 @@ on:
branches:
- master
paths:
- 'CHANGELOG.md'
- "CHANGELOG.md"


jobs:
update-version:
name: "Create Strauss phar on new release"
runs-on: ubuntu-latest
name: Create Strauss phar on new release
permissions:
contents: write
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: "Checkout repository"
uses: actions/checkout@v4
with:
ref: master

- name: "Edit `strauss/bin/strauss` to update the version number"
- name: "Update version number in `bin/strauss`"
run: |
CURRENT_RELEASE=$(cat CHANGELOG.md | grep --max-count=1 -o '##.*' | awk '{print $2}')
find bin -name 'strauss' -exec sed -i "s/}, '[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*');/}, '$CURRENT_RELEASE');/" {} +
CURRENT_RELEASE="$(sed -n -e '0,/^## \([0-9.]\+\).*$/ s//\1/p' CHANGELOG.md)"
test -n "${CURRENT_RELEASE}"
sed -i -e "s/^}, '[0-9.]\\+');\$/}, '${CURRENT_RELEASE}');/" bin/strauss
- name: Commit updated README.md
uses: stefanzweifel/[email protected]
with:
branch: master
file_pattern: "bin/strauss"
commit_message: "🤖 Update version number in bin"
- name: "Commit `bin/strauss` changes"
run: |
if git diff --quiet; then
echo "No changes."
exit 0
fi
git add -- bin/strauss
git commit -m "🤖 Update version number in bin"
git push

0 comments on commit 2286cee

Please sign in to comment.