Skip to content

Commit a690b89

Browse files
committed
chore(ci): generate auth token for commit
1 parent 79b9b54 commit a690b89

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ jobs:
1313
id-token: write
1414
contents: write
1515
steps:
16+
- uses: actions/create-github-app-token@v2
17+
id: app-token
18+
with:
19+
# required
20+
app-id: ${{ secrets.APP_ID }}
21+
private-key: ${{ secrets.PRIVATE_KEY }}
22+
- name: Get GitHub App User ID
23+
id: get-user-id
24+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
25+
env:
26+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
27+
- run: |
28+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
29+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
1630
- name: Checkout code
1731
uses: actions/checkout@v5
1832
- uses: pnpm/action-setup@v4
@@ -22,21 +36,14 @@ jobs:
2236
cache: 'pnpm'
2337
- name: Install dependencies
2438
run: pnpm install
25-
- name: Set publishing config
26-
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
27-
env:
28-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2939
- name: Tag and Release
3040
run: |
31-
git config --global user.email "[email protected]"
32-
git config --global user.name "GitHub Action"
3341
pnpm ci:version
3442
git add .
3543
git commit -m "chore(release): publish"
3644
pnpm ci:tag
3745
pnpm ci:publish
3846
git push && git push --tags
3947
env:
40-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
41-
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
48+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
4249
NPM_CONFIG_PROVENANCE: true

0 commit comments

Comments
 (0)