Updates package versions when a release or hotfix branch is created (#329)

This commit is contained in:
Iskandar Kurbonov 2024-05-21 13:00:25 +05:00 committed by GitHub
parent c24bc8f655
commit 0caa51fcc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

30
.github/workflows/update-version.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Update packages versions
on:
create:
jobs:
change-version:
if: (startsWith(github.ref, 'refs/heads/release/') ||
startsWith(github.ref, 'refs/heads/hotfix/'))
name: "Update packages versions"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: '${{ github.token }}'
- name: Filter changes and update versions
run: |
VERSION=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/[^0-9.]*//g')
echo "VERSION=$VERSION" >> $GITHUB_ENV
sed -i "s/\(\"version\":\).*/\1 \"$VERSION\",/g" packages/*/package.json
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: github-actions[bot]
author_email: github-actions[bot]@users.noreply.github.com
message: Update version in packages.json to v${{ env.VERSION }}