Skip to content

Commit 2d13e96

Browse files
create-release (#729)
* Revert "Revert "Update release.yml (#727)" (#728)" This reverts commit 66e22e7. * Update release.yml
1 parent 66e22e7 commit 2d13e96

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
runs-on: ubuntu-latest
5252
env:
5353
GITHUB_TOKEN: ${{ secrets.OR_GITHUB_TOKEN }}
54+
BRANCH_NAME: npm-version-patch
5455
steps:
5556

5657
# CHECKOUT PROJECT
@@ -67,7 +68,7 @@ jobs:
6768
# SETUP NODE
6869
- uses: actions/[email protected]
6970
with:
70-
node-version: 10
71+
node-version: 22.5.1
7172
registry-url: https://npm.pkg.github.com/
7273

7374
# GET TAG NAME
@@ -76,7 +77,7 @@ jobs:
7677
if [ ${{ inputs.dev }} == true ]; then
7778
echo "TAG_NAME=$(npm version prerelease --preid=${{ inputs.jsTag }} --no-git-tag-version --allow-same-version)" >> $GITHUB_ENV
7879
else
79-
echo "TAG_NAME=$(npm version patch)" >> $GITHUB_ENV
80+
echo "TAG_NAME=$(npm version patch --no-git-tag-version)" >> $GITHUB_ENV
8081
fi
8182
8283
# DOWNLOAD CLI IF IT IS A DEV VERSION AND A CLI TAG WAS PROVIDED
@@ -93,11 +94,42 @@ jobs:
9394
npm ci
9495
npm run build
9596
97+
# CREATE PR FOR VERSION
98+
- name: Create Pull Request
99+
id: create_pr
100+
if: inputs.dev == false
101+
uses: peter-evans/[email protected]
102+
with:
103+
token: ${{ env.GITHUB_TOKEN }}
104+
branch: ${{ env.BRANCH_NAME }}
105+
title: "Update Version - Automated Changes"
106+
body: "This is an automated PR created by GitHub Actions"
107+
base: main
108+
draft: false
109+
110+
# WAIT FOR PR CREATION
111+
- name: Wait for PR to be created
112+
id: pr
113+
if: inputs.dev == false
114+
uses: octokit/[email protected]
115+
with:
116+
route: GET /repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ env.BRANCH_NAME }}
117+
118+
# MERGE PR TO MAIN
119+
- name: Merge Pull Request
120+
if: inputs.dev == false
121+
uses: octokit/[email protected]
122+
with:
123+
route: PUT /repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull-request-number }}/merge
124+
merge_method: squash
96125

97126
# PUSH TAGS IF IT IS A RELEASE
98-
- name: Push tag if release
127+
- name: Push tag
99128
if: inputs.dev == false
100-
run: git push && git push --tags
129+
run: |
130+
git pull
131+
git tag ${{env.TAG_NAME}}
132+
git push --tags
101133
102134
103135
# PUBLISH NPM PACKAGE

0 commit comments

Comments
 (0)