Skip to content

Commit c0dda83

Browse files
authored
Merge pull request #34 from tklepzig/use-npm-trusted-publishing
Adjust CI to use npm trusted publishing
2 parents 7ca86ad + c051d12 commit c0dda83

4 files changed

Lines changed: 35 additions & 12 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish switch
2+
3+
on:
4+
issue_comment:
5+
types: ["created"]
6+
push:
7+
branches:
8+
- master
9+
10+
permissions:
11+
id-token: write
12+
13+
jobs:
14+
release-snapshot:
15+
if: github.event_name == 'issue_comment'
16+
uses: ./.github/workflows/release-snapshot.yml
17+
secrets: inherit
18+
permissions:
19+
id-token: write
20+
pull-requests: write
21+
22+
release:
23+
if: github.event_name == 'push'
24+
uses: ./.github/workflows/release.yml
25+
secrets: inherit
26+
permissions:
27+
id-token: write

.github/workflows/release-snapshot.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Release Snapshot
22

33
on:
4-
issue_comment:
5-
types: ["created"]
4+
workflow_call:
65

76
concurrency: ${{ github.workflow }}-${{ github.ref }}
87

@@ -13,6 +12,9 @@ jobs:
1312
${{ github.event.issue.pull_request && github.event.comment.body ==
1413
'/snapshot' }}
1514
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write
17+
pull-requests: write
1618
steps:
1719
- name: Add initial reaction
1820
uses: peter-evans/create-or-update-comment@v4
@@ -64,11 +66,6 @@ jobs:
6466
- name: Build packages
6567
run: npm run build
6668

67-
- name: Create .npmrc
68-
run:
69-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >
70-
~/.npmrc
71-
7269
- name: Publish packages
7370
id: publish
7471
run: |

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: Release
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
workflow_call:
75

86
concurrency: ${{ github.workflow }}-${{ github.ref }}
97

108
jobs:
119
release:
1210
name: Release
1311
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
1414
steps:
1515
- name: Checkout Repo
1616
uses: actions/checkout@v4
@@ -33,4 +33,3 @@ jobs:
3333
title: Publish Version
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
36-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 20.10.0
1+
nodejs 24.11.0

0 commit comments

Comments
 (0)