From 038e95af6fbaa655f620add834fba3c56dddee59 Mon Sep 17 00:00:00 2001 From: Dylan700 <54528768+Dylan700@users.noreply.github.com> Date: Thu, 21 Dec 2023 11:21:21 +1100 Subject: [PATCH] Update Workflow (#5) --- .github/workflows/publish.yml | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cb512fa..2ee8442 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,38 +30,26 @@ jobs: run: | VERSION=${{ github.event.release.tag_name }} jq '.version = "'${VERSION#v}'"' package.json > tmp.json && mv tmp.json package.json - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git checkout -b release/$VERSION - git add . - git commit -m "Update version to $VERSION" - git push origin release/$VERSION - name: Create PR - run: | - PR=$(curl -s -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/${{ github.repository }}/pulls \ - -d '{ - "title": "Release '$VERSION'", - "head": "release/'$VERSION'", - "base": "master" - }') - echo $PR - PR_NUMBER=$(echo $PR | jq .number) - echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + title: Release ${{ github.event.release.tag_name }} + branch: release/${{ github.event.release.tag_name }} + base: master - name: Merge PR run: | MERGE_RESPONSE=$(curl -s -X PUT \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/${{ github.repository }}/pulls/${{ env.PR_NUMBER }}/merge \ + https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull-request-number }}/merge \ -d '{ - "commit_title": "Merge release '$VERSION'" + "commit_title": "Merge release '${{ github.event.release.tag_name }}'" }') echo $MERGE_RESPONSE + id: merge_pr - name: Run latest-tag uses: EndBug/latest-tag@v1.5.1