From 966c98bafb0dd19eb9b54551f526b8dc80761870 Mon Sep 17 00:00:00 2001 From: tamarleviCm <110327792+tamarleviCm@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:13:40 +0300 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9bde73e1..1ce93297 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,6 +51,7 @@ jobs: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.OR_GITHUB_TOKEN }} + BRANCH_NAME: npm-version-patch steps: # CHECKOUT PROJECT @@ -93,9 +94,40 @@ jobs: npm run build # PUSH TAGS IF IT IS A RELEASE - - name: Push tag if release + - name: Push tag if: inputs.dev == false - run: git push && git push --tags + run: | + git pull + git push --tags + + # CREATE PR FOR VERSION AND TAG CHANGES + - name: Create Pull Request + id: create_pr + if: inputs.dev == false + uses: peter-evans/create-pull-request@v6.0.5 + with: + token: ${{ env.GITHUB_TOKEN }} + branch: ${{ env.BRANCH_NAME }} + title: "Update Version - Automated Changes" + body: "This is an automated PR created by GitHub Actions" + base: main + draft: false + + # WAIT FOR PR CREATION + - name: Wait for PR to be created + id: pr + if: inputs.dev == false + uses: octokit/request-action@v2.3.1 + with: + route: GET /repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ env.BRANCH_NAME }} + + # MERGE PR TO MAIN + - name: Merge Pull Request + if: inputs.dev == false + uses: octokit/request-action@v2.3.1 + with: + route: PUT /repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull-request-number }}/merge + merge_method: squash # PUBLISH NPM PACKAGE - name: Publish npm package