Skip to content

Commit

Permalink
Automatic update of the references to the stable release in README.md
Browse files Browse the repository at this point in the history
Each time a new stable version is released, the corresponding references in README.md must be updated. Manual update is error prone not considering that it might be overlooked by maintainers until someone opens an issue (see issue #337 and PR #338).

This commit fixes that and automatically pushes changes to README.md to update all the references when a new stable release is built.
  • Loading branch information
bcoconni committed Jan 23, 2021
1 parent 50e6fbe commit 7ded164
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/cpp-python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ jobs:
dist/*.whl
dist/*.deb
Official-Release:
Stable-Release:
needs: [ManyLinux-Wheels, MacWin-Wheels]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -437,7 +437,7 @@ jobs:
twine upload dist/*.whl
twine upload dist/*.tar.gz
# Deploy official release to GitHub
# Deploy stable release to GitHub
- name: Get JSBSim version
run: |
pip install -U numpy
Expand All @@ -453,13 +453,14 @@ jobs:
body: |
JSBSim version ${{ env.VERSION }}
**Release files:**
## Release files
- Windows 64 bits
- `JSBSim-${{ env.VERSION}}-setup.exe` (Windows installer)
- `JSBSim-${{ env.VERSION }}-setup.exe` (Windows installer)
- Ubuntu Xenial 16.04, Bionic 18.04 or Focal 20.04 - amd64
- `*.deb` (Debian packages)
- Python wheel packages can be installed from [PyPI](https://pypi.org/project/JSBSim/) with the command `pip install jsbsim` or `pip install --upgrade jsbsim` when JSBSim is already installed on your system.
**Changelog:**
## Changelog
prerelease: false
draft: false
files: |
Expand All @@ -471,21 +472,41 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Bump patch version
- name: Bump version
run: |
# Increment the value of PROJECT_VERSION_PATCH
sed -ri 's/(set\(PROJECT_VERSION_PATCH\s\")([0-9]+)(.*)/echo "\1\\"$((\2+1))\\"\3"/ge' CMakeLists.txt
# Update references to the current stable version in README.md
export PREV_VERSION=`egrep 'JSBSim-([0-9]+\.)+[0-9]+-setup.exe' README.md | awk -F'JSBSim-' '{ print $2}' | awk -F'-setup.exe' '{ print $1}'`
sed -ri 's/_'"$PREV_VERSION"'-[0-9]+.amd64.deb/_'"$VERSION"'-'"$GITHUB_RUN_NUMBER"'.amd64.deb/g' README.md
sed -ri 's/'"$PREV_VERSION"'/'"$VERSION"'/g' README.md
# Determine the branch name
export BRANCH_NAME=`git branch -a --contains HEAD | awk -F'/' 'NR==2 { s=$3;for(i=4;i<=NF;i++){ s=s"/"$i };print s }'`
# Commit the change to CMakeLists.txt
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout $BRANCH_NAME
git commit -m "Bump version" CMakeLists.txt
git commit -m "Bump version" CMakeLists.txt README.md
git push origin $BRANCH_NAME
# Bump stable version of the `master` branch
- name: Checkout JSBSim master branch
uses: actions/checkout@v2
with:
ref: master
path: _master
- name: Bump stable version in README.md
working-directory: _master
run: |
# Update references to the current stable version in README.md
export PREV_VERSION=`egrep 'JSBSim-([0-9]+\.)+[0-9]+-setup.exe' README.md | awk -F'JSBSim-' '{ print $2}' | awk -F'-setup.exe' '{ print $1}'`
sed -ri 's/_'"$PREV_VERSION"'-[0-9]+.amd64.deb/_'"$VERSION"'-'"$GITHUB_RUN_NUMBER"'.amd64.deb/g' README.md
sed -ri 's/'"$PREV_VERSION"'/'"$VERSION"'/g' README.md
git commit -m "Bump stable release version" README.md
git push origin master
Documentation:
needs: Official-Release
needs: Stable-Release
runs-on: ubuntu-latest
steps:
- name: Install Ubuntu packages
Expand Down

0 comments on commit 7ded164

Please sign in to comment.