Skip to content

Commit

Permalink
Fix workflow update for package.json (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan700 committed Dec 20, 2023
1 parent 376e8ee commit 147fc24
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,43 @@ jobs:
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 commit -am "Update version to $VERSION"
git checkout -b release/$VERSION
git add .
git commit -m "Update version to $VERSION"
git push origin release/$VERSION
- name: Apply latest tag
- name: Create PR
run: |
git tag -fa @latest -m "Update @latest tag"
git push origin @latest
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
- 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 \
-d '{
"commit_title": "Merge release '$VERSION'"
}')
echo $MERGE_RESPONSE
- name: Run latest-tag
uses: EndBug/[email protected]
with:
force-branch: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update release
run: |
Expand Down

0 comments on commit 147fc24

Please sign in to comment.