Skip to content

Commit ab8bc1c

Browse files
Heiko KieselWeltraumschaf
authored andcommitted
Automatically update versions in README.md upon release
Signed-off-by: Heiko Kiesel <heiko.kiesel@iteratec.com>
1 parent e036471 commit ab8bc1c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,23 @@ jobs:
8282
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
8383
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
8484
MAVEN_GPG_PASSPHRASE: ${{ secrets.SIGNING_PASSWORD }}
85-
85+
86+
- name: "Extract maven version" # required for following change readme step
87+
id: extract-version
88+
run: |
89+
MVN_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
90+
echo "MVN_VERSION=$MVN_VERSION" >> $GITHUB_ENV
91+
92+
# Replaced all version occurrences in README.md (e.g., 1.0.0, 1.0.0-SNAPSHOT, and 1.0.0-beta3)
93+
- name: "Change README"
94+
run: |
95+
sed -i -e 's/[0-9].[0-9].[0-9]\(-[A-z0-9]*\)*/${{ steps.extract-version.outputs.MVN_VERSION }}/g' README.md
96+
git add README.md
97+
git commit -S -m "Update version in README"
98+
git push
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.SCB_BOT_USER_TOKEN }}
101+
86102
# Required for creation of GitHub release
87103
- name: "Get previous tag"
88104
id: previous_tag

0 commit comments

Comments
 (0)