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 README with Latest Version | ||
on: | ||
release: | ||
types: [created] | ||
permissions: | ||
contents: write # Grant write permission to the contents | ||
jobs: | ||
update-readme: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
- name: Get Release Tag Name | ||
id: get_tag_name | ||
run: echo "RELEASE_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | ||
- name: Extract Version Number | ||
id: extract_version | ||
run: echo "::set-output name=VERSION::${{ env.RELEASE_TAG:1 }}" | ||
Check failure on line 24 in .github/workflows/update-version.yml GitHub Actions / Update README with Latest VersionInvalid workflow file
Check failure on line 24 in .github/workflows/update-version.yml GitHub Actions / Update README with Latest VersionInvalid workflow file
Check failure on line 24 in .github/workflows/update-version.yml GitHub Actions / Update README with Latest VersionInvalid workflow file
Check failure on line 24 in .github/workflows/update-version.yml GitHub Actions / Update README with Latest VersionInvalid workflow file
|
||
- name: Update README.md | ||
run: | | ||
LATEST_VERSION=${{ steps.extract_version.outputs.VERSION }} | ||
# Replace the version string in the Gradle dependency line | ||
sed -i "s/de\.derioo:javautils:[0-9]*\.[0-9]*\.[0-9]*/de.derioo:javautils:${LATEST_VERSION}/g" README.md | ||
# Replace the version string in the Maven dependency line | ||
sed -i "s/<version>[0-9]*\.[0-9]*\.[0-9]*<\/version>/<version>${LATEST_VERSION}<\/version>/g" README.md | ||
- name: Commit and Push Changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git checkout -b update-readme-with-latest-version | ||
git add README.md | ||
git commit -m "Update README with latest version ${{ env.RELEASE_TAG }}" | ||
git push --force origin update-readme-with-latest-version:main |