Skip to content

Commit

Permalink
update regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ziodave committed Jul 10, 2024
1 parent 8d7d13e commit fe656fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/publish-readme.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/bin/bash

get_version() {
grep -E '^ \* Version:\s+(\d+\.\d+\.\d+)$' src/wordlift.php | grep -oE '(\d+\.\d+\.\d+)$'
# This regex is crafted to work on ubuntu:22.04 which is the GH runner.
grep -P '^ \* Version:\s+(\d+\.\d+\.\d+)$' src/wordlift.php | grep -oP '(\d+\.\d+\.\d+)$'
}

if [[ 'src/readme.txt' == "$(git diff HEAD^ HEAD --name-only)" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
echo 'readme.txt has been updated, pushing...'

version="$(get_version)"
echo "** Using version $version"
sed -i "s|^Stable tag: .*$|Stable tag: $version|g" src/readme.txt

echo "** readme.txt new contents: "
Expand Down

0 comments on commit fe656fe

Please sign in to comment.