-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (54 loc) · 2.02 KB
/
Copy pathpublish-npm.yml
File metadata and controls
65 lines (54 loc) · 2.02 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Publish npm package
on:
push:
tags: ['v*']
jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
package-manager-cache: false # never use caching in release builds
- name: Set versions from tag
run: |
set -e
SOURCE_TAG="${GITHUB_REF#refs/tags/}"
VERSION="${SOURCE_TAG#v}"
npm version --no-git-tag-version -w gitsheets "$VERSION"
npm version --no-git-tag-version -w gitsheets-axi "$VERSION"
- name: Pin gitsheets-axi → gitsheets dep range
run: |
set -e
SOURCE_TAG="${GITHUB_REF#refs/tags/}"
VERSION="${SOURCE_TAG#v}"
# gitsheets-axi declares `"gitsheets": "*"` so the workspace symlink
# resolves during development. At publish time, pin it to the exact
# matching minor — lockstep with gitsheets means `gitsheets-axi@1.3.x`
# always wants `gitsheets@^1.3.0`.
MINOR_RANGE="^${VERSION%%-*}"
node -e "
const fs = require('fs');
const p = require('./packages/gitsheets-axi/package.json');
p.dependencies.gitsheets = '$MINOR_RANGE';
fs.writeFileSync('./packages/gitsheets-axi/package.json', JSON.stringify(p, null, 2) + '\n');
"
cat packages/gitsheets-axi/package.json | grep gitsheets
- run: npm ci
# Build before type-check and test — gitsheets-axi consumes `gitsheets`
# through its `dist/` output.
- name: Build
run: npm run build
- name: Type-check
run: npm run type-check
- name: Test
run: npm test
- name: Publish gitsheets
run: npm publish --provenance --access public -w gitsheets
- name: Publish gitsheets-axi
run: npm publish --provenance --access public -w gitsheets-axi