-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (64 loc) · 2.18 KB
/
publish.yml
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
66
67
68
69
70
71
72
on:
release:
types: [published]
name: publish-to-npmjs
env:
PNPM_VERSION: "9.0.4"
NODE_VERSION: "18.17.0"
jobs:
publish:
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: "${{ env.PNPM_VERSION }}"
- uses: actions/setup-node@v4
with:
cache: pnpm
node-version: "${{ env.NODE_VERSION }}"
# Forces the creation of an .npmrc that reads `NODE_AUTH_TOKEN`
registry-url: "https://registry.npmjs.org"
- name: Register package name
run: |
PACKAGE_NAME=`echo "${{ github.event.release.name }}" | cut -d ' ' -f 1`
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
- name: Publish single module
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
NPM_CONFIG_PROVENANCE: true
# the `echo` below deliberately uses single quotes so that the
# token isn’t written to the file; instead, npm should replace
# it at runtime.
run: |
pushd packages/$PACKAGE_NAME
pnpm install --frozen-lockfile --filter "$PACKAGE_NAME..."
# `publish` calls `npm run build` because of the `prepublish` hook.
pnpm publish --filter "$PACKAGE_NAME" --no-git-checks
popd
- name: Check out just docs
uses: actions/checkout@v4
with:
ref: "gh-pages"
sparse-checkout: "docs-json"
- name: Update documentation
run: |
pnpm install -r --frozen-lockfile
mkdir -p docs-json
pushd packages/$PACKAGE_NAME
npx typedoc --json ../../docs-json --options typedoc.json --validation.invalidLink
popd
npx typedoc --entrypointStrategy merge "docs-json/*.json"
- name: Deploy docs to GitHub Pages
if: success()
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}