aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/publish.yml
blob: 6cec06bf368483a2f459032bc926cc4a9e0db14a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: publish
 
on:
  push:
    tags: ["v*"]
 
jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      # npm trusted publishing: the workflow's OIDC identity is the credential,
      # no NPM_TOKEN secret anywhere (configured on npmjs.com under the
      # package's Trusted Publisher settings)
      id-token: write
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          # npm >= 11.5 for OIDC publishing; node 24 bundles it
          node-version: 24
          registry-url: https://registry.npmjs.org
      - run: npm ci
      - run: npm run typecheck
      - name: tag matches package.json
        run: test "v$(node -p "require('./package.json').version")" = "$GITHUB_REF_NAME"
      - name: publish, unless the version is already on the registry
        run: |
          v=$(node -p "require('./package.json').version")
          if npm view "durable-git@$v" version >/dev/null 2>&1; then
            echo "durable-git@$v already published, skipping"
          else
            npm publish
          fi