3838 uses : actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
3939 with :
4040 node-version : 16
41-
42- # In order to make a commit, we need to initialize a user.
43- # You may choose to write something less generic here if you want, it doesn't matter functionality wise.
44- - name : Initialize mandatory git config
45- run : |
46- git config user.name "GitHub actions"
47- git config user.email noreply@github.com
4841
4942 # Calculate the next release version based on conventional semantic release
5043 - name : Create release branch
5750 git fetch origin master --depth=1
5851 git merge origin/master
5952 current_version=$(jq -r .version package.json)
60-
53+
6154 npx standard-version --skip.commit --skip.tag --skip.changelog
6255 new_version=$(jq -r .version package.json)
6356 git reset --hard
@@ -69,15 +62,23 @@ jobs:
6962 echo "Release type is $release_type"
7063 echo "New version is $new_version"
7164 echo "New release branch name is $branch_name"
72- git checkout -b "$branch_name"
73- git push --set-upstream origin "$branch_name"
74-
65+
7566 echo "source_branch_name=$source_branch_name" >> $GITHUB_OUTPUT
7667 echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
7768 echo "new_version=$new_version" >> $GITHUB_OUTPUT
7869 echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
7970 echo "NEW_VERSION_VALUE=$new_version" >> $GITHUB_ENV
8071
72+ - name : Create release branch via GitHub API
73+ env :
74+ GH_TOKEN : ${{ steps.generate-token.outputs.token }}
75+ run : |
76+ BASE_SHA=$(git rev-parse origin/master)
77+ gh api repos/${{ github.repository }}/git/refs \
78+ --method POST \
79+ -f ref="refs/heads/${{ steps.create-release.outputs.branch_name }}" \
80+ -f sha="$BASE_SHA"
81+
8182 - name : Update changelog & bump version
8283 id : finish-release
8384 env :
@@ -89,14 +90,22 @@ jobs:
8990 echo "Current version: $CURRENT_VERSION_VALUE"
9091 echo "New version: $NEW_VERSION_VALUE"
9192 npx replace $CURRENT_VERSION_VALUE $NEW_VERSION_VALUE README.md
92- git add README.md
9393 echo ${{ steps.create-release.outputs.new_version }}
9494 echo "commit_summary=$SUMMARY" >> $GITHUB_OUTPUT
95- npx standard-version -a
95+ npx standard-version --skip.commit --skip.tag
9696
97- - name : Push new version in release branch & tag
98- run : |
99- git push --follow-tags
97+ - name : Create verified commit and tag via GitHub API
98+ uses : ryancyq/github-signed-commit@e9f3b28c80da7be66d24b8f501a5abe82a6b855f # v1.2.0
99+ env :
100+ GH_TOKEN : ${{ steps.generate-token.outputs.token }}
101+ with :
102+ branch-name : ${{ steps.create-release.outputs.branch_name }}
103+ commit-message : ' chore(release): v${{ steps.create-release.outputs.new_version }}'
104+ files : |
105+ CHANGELOG.md
106+ package.json
107+ README.md
108+ tag : ' v${{ steps.create-release.outputs.new_version }}'
100109
101110 - name : Create pull request into master
102111 uses : repo-sync/pull-request@7e79a9f5dc3ad0ce53138f01df2fad14a04831c5 # v2.12.1
0 commit comments