Skip to content

Commit e1b7722

Browse files
SHIVA-juspayYaswanth0606
authored andcommitted
fix npm publish
1 parent 3a088fe commit e1b7722

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ jobs:
1212
runs-on: ubuntu-latest
1313
permissions:
1414
id-token: write
15-
contents: read
15+
contents: write
16+
1617
steps:
1718

1819
- name: Generate GitHub app token
@@ -25,9 +26,8 @@ jobs:
2526
- name: Checkout code
2627
uses: actions/checkout@v4
2728
with:
28-
repository: ${{ github.event.pull_request.head.repo.full_name }}
2929
token: ${{ steps.generate_app_token.outputs.token }}
30-
fetch-depth: ${{ github.event.pull_request.commits }}
30+
fetch-depth: 0
3131

3232
- name: Set up Node.js
3333
uses: actions/setup-node@v4
@@ -43,14 +43,14 @@ jobs:
4343
run: |
4444
shopt -s nocasematch
4545
46-
PR_TITLE='${{ github.event.pull_request.title }}'
46+
COMMITS="$(git log --format=%B -1 ${{ github.event.pull_request.merge_commit_sha }})"
4747
48-
if [[ "$PR_TITLE" =~ (\[breaking\]|\[major\]) ]]; then
49-
echo "release_type=major" >> $GITHUB_OUTPUT
50-
elif [[ "$PR_TITLE" =~ \[minor\] ]]; then
51-
echo "release_type=minor" >> $GITHUB_OUTPUT
48+
if [[ "$COMMITS" == *"[breaking]"* || "$COMMITS" == *"[major]"* ]]; then
49+
echo "release_type=major" >> "$GITHUB_OUTPUT"
50+
elif [[ "$COMMITS" == *"[minor]"* ]]; then
51+
echo "release_type=minor" >> "$GITHUB_OUTPUT"
5252
else
53-
echo "release_type=patch" >> $GITHUB_OUTPUT
53+
echo "release_type=patch" >> "$GITHUB_OUTPUT"
5454
fi
5555
5656
shopt -u nocasematch
@@ -85,8 +85,6 @@ jobs:
8585
8686
- name: Push tags and changelog
8787
run: git push --follow-tags origin main
88-
env:
89-
GH_TOKEN: ${{ steps.generate_app_token.outputs.token }}
9088

9189
- name: create release
9290
uses: actions/create-release@v1
@@ -98,4 +96,4 @@ jobs:
9896
body: "${{ steps.changelog.outputs.clean_changelog }}"
9997

10098
- name: Publish package on NPM 📦
101-
run: npm publish --access public --tag latest
99+
run: npm publish --access public

0 commit comments

Comments
 (0)