Skip to content

Commit c3ad61e

Browse files
authored
Setup trusted publishing to NPM (#92)
1 parent a496e50 commit c3ad61e

File tree

3 files changed

+42
-26
lines changed

3 files changed

+42
-26
lines changed

.github/actions/setup/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Setup
2+
description: Perform standard setup and install dependencies using pnpm.
3+
inputs:
4+
node-version:
5+
description: The version of Node.js to install
6+
required: true
7+
default: 23.7.0
8+
registry-url:
9+
description: Optional registry to set up for auth
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v3
16+
- name: Install node
17+
uses: actions/setup-node@v4
18+
with:
19+
cache: pnpm
20+
node-version: ${{ inputs.node-version }}
21+
registry-url: ${{ inputs.registry-url }}
22+
- name: Install dependencies
23+
shell: bash
24+
run: pnpm install

.github/workflows/main.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,27 @@ on:
77
# Allows you to run this workflow manually from the Actions tab
88
workflow_dispatch:
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
1013
permissions: {}
1114

1215
jobs:
1316
build:
17+
if: github.repository_owner == 'Effect-Ts'
1418
runs-on: ubuntu-latest
1519
permissions:
1620
contents: write
1721
id-token: write
1822
pull-requests: write
1923
steps:
20-
- uses: actions/checkout@v3
21-
with:
22-
fetch-depth: 0
23-
- name: Install pnpm
24-
uses: pnpm/action-setup@v3
25-
- name: Install node
26-
uses: actions/setup-node@v4
27-
with:
28-
cache: pnpm
29-
node-version: 22.2.0
24+
- uses: actions/checkout@v4
3025
- name: Install dependencies
31-
shell: bash
32-
run: pnpm install
26+
uses: ./.github/actions/setup
27+
with:
28+
registry-url: "https://registry.npmjs.org"
29+
- name: Upgrade npm for OIDC support
30+
run: npm install -g npm@latest
3331
- name: Type check
3432
run: tsc --noEmit
3533
- run: pnpm build
@@ -41,4 +39,3 @@ jobs:
4139
publish: pnpm exec changeset publish
4240
env:
4341
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/pr.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,19 @@ on:
88
# Allows you to run this workflow manually from the Actions tab
99
workflow_dispatch:
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
14+
permissions: {}
15+
1116
jobs:
1217
build:
18+
if: github.repository_owner == 'Effect-Ts'
1319
runs-on: ubuntu-latest
14-
1520
steps:
16-
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
19-
- name: Install pnpm
20-
uses: pnpm/action-setup@v3
21-
- name: Install node
22-
uses: actions/setup-node@v4
23-
with:
24-
cache: pnpm
25-
node-version: 22.2.0
21+
- uses: actions/checkout@v4
2622
- name: Install dependencies
27-
shell: bash
28-
run: pnpm install
23+
uses: ./.github/actions/setup
2924
- name: Type check
3025
run: tsc --noEmit
3126
- run: pnpm build

0 commit comments

Comments
 (0)