-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: github-actions <github-actions@github.com>
- Loading branch information
1 parent
2ef070e
commit 11e6202
Showing
6 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Update Version | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- release/** | ||
paths: | ||
- 'VERSION' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
update-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
|
||
- name: Read version | ||
id: read_version | ||
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV | ||
|
||
- name: Update Version in Files | ||
run: | | ||
VERSION=${{ env.VERSION }} | ||
sed -i "s/^version: .*/version: ${VERSION}/" CITATION.cff | ||
sed -i "s/^release = \".*\"/release = \"v${VERSION}\"/" docs/conf.py | ||
sed -i "s/^version = \".*\"/version = \"${VERSION}\"/" pyproject.toml | ||
# Update header file | ||
IFS='.' read -ra VER <<< "$VERSION" | ||
MAJOR=${VER[0]} | ||
MINOR=${VER[1]} | ||
PATCH=${VER[2]} | ||
sed -i "s/#define MSCCLPP_MAJOR .*/#define MSCCLPP_MAJOR ${MAJOR}/" include/mscclpp/core.hpp | ||
sed -i "s/#define MSCCLPP_MINOR .*/#define MSCCLPP_MINOR ${MINOR}/" include/mscclpp/core.hpp | ||
sed -i "s/#define MSCCLPP_PATCH .*/#define MSCCLPP_PATCH ${PATCH}/" include/mscclpp/core.hpp | ||
- name: Commit and Push Changes | ||
run: | | ||
git config user.name "github-actions" | ||
git config user.email "github-actions@github.com" | ||
git add CITATION.cff docs/conf.py include/mscclpp/core.hpp pyproject.toml || true | ||
if git diff --cached --exit-code; then | ||
echo "No changes to commit." | ||
else | ||
git commit -m "Update version to ${{ env.VERSION }}" | ||
git push | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.6.0 |
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
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
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