From 0caa51fcc2dc3264ded4824bc55f749d2d020157 Mon Sep 17 00:00:00 2001 From: Iskandar Kurbonov <116521281+IskandarKurbonov@users.noreply.github.com> Date: Tue, 21 May 2024 13:00:25 +0500 Subject: [PATCH] Updates package versions when a release or hotfix branch is created (#329) --- .github/workflows/update-version.yml | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/update-version.yml diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml new file mode 100644 index 0000000000..ea45f99adc --- /dev/null +++ b/.github/workflows/update-version.yml @@ -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 }} +