Skip to content

Update version number #9

Update version number

Update version number #9

Workflow file for this run

name: Update Version
on:
pull_request:
branches:
- main
- release/**
paths:
- 'VERSION'
permissions:
id-token: write
contents: read
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 "[email protected]"
git add CITATION.cff docs/conf.py include/mscclpp/core.hpp pyproject.toml
git commit -m "Update version to ${{ env.VERSION }}"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}