Skip to content

Commit f9a5665

Browse files
committed
ci: update and adjust release workflow
1 parent 1fb02ca commit f9a5665

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
types: [completed]
77
branches: [master, next]
88

9+
permissions:
10+
id-token: write
11+
contents: write
12+
913
jobs:
1014
release:
1115
runs-on: ubuntu-latest
@@ -20,21 +24,29 @@ jobs:
2024
node-version: 24
2125
cache: 'npm'
2226
registry-url: https://registry.npmjs.org/
27+
- name: Update npm
28+
run: npm install -g npm@latest
2329
- run: npm ci
24-
- run: git config user.name "cerebral[bot]"
25-
- run: git config user.email "136202705+cerebral[bot]@users.noreply.github.com"
26-
- name: Create token
27-
id: create_token
28-
uses: tibdex/github-app-token@v2
30+
- name: Create GitHub App token
31+
id: app-token
32+
uses: actions/create-github-app-token@v3
2933
with:
30-
app_id: ${{ secrets.APP_ID }}
31-
private_key: ${{ secrets.PRIVATE_KEY }}
34+
app-id: ${{ secrets.APP_ID }}
35+
private-key: ${{ secrets.PRIVATE_KEY }}
36+
- name: Get GitHub App User ID
37+
id: get-user-id
38+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
39+
env:
40+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
41+
- name: Configure Git
42+
run: |
43+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
44+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
3245
- name: Release packages
3346
run: npm run release -- --no-parallel --print-release
3447
if: github.event_name != 'pull_request'
3548
env:
36-
REPO_COOKER_GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
37-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
REPO_COOKER_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
3850
- name: Publish vscode extension to Visual Studio Marketplace
3951
if: github.event_name != 'pull_request' && github.event.workflow_run.head_branch == 'master'
4052
uses: HaaLeo/publish-vscode-extension@v2

0 commit comments

Comments
 (0)