Skip to content

Commit

Permalink
Update Workflow (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan700 committed Dec 21, 2023
1 parent b472c85 commit 038e95a
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]"
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/[email protected]
Expand Down

0 comments on commit 038e95a

Please sign in to comment.