-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 2.62 KB
/
Copy pathrelease-please.yml
File metadata and controls
70 lines (60 loc) · 2.62 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
66
67
68
69
70
name: Release Please
on:
push:
branches: [main]
permissions:
contents: write
pull-requests: write
id-token: write
jobs:
release-please:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: googleapis/release-please-action@v5
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
# Publish is inlined here (not a separate workflow on release:created)
# because GitHub does not trigger downstream workflows from events
# authored by the default GITHUB_TOKEN — release-please-action's
# GitHub release never fires release:created, so the previous
# publish.yml never ran.
#
# `releases_created` (plural) is what the action sets in manifest
# mode; the singular `release_created` only exists in non-manifest
# mode and would silently skip every step here. We must compare
# against the literal string 'true' — release-please-action emits
# 'false' (not an empty string) when no release was created, and
# GitHub Actions treats any non-empty string as truthy, so a bare
# `if: ${{ steps.release.outputs.releases_created }}` would run on
# every push to main.
- uses: actions/checkout@v7
if: ${{ steps.release.outputs.releases_created == 'true' }}
- uses: ./.github/actions/setup
if: ${{ steps.release.outputs.releases_created == 'true' }}
- run: pnpm run lint
if: ${{ steps.release.outputs.releases_created == 'true' }}
- run: pnpm run typecheck
if: ${{ steps.release.outputs.releases_created == 'true' }}
- run: pnpm test
if: ${{ steps.release.outputs.releases_created == 'true' }}
- run: pnpm run build:clean
if: ${{ steps.release.outputs.releases_created == 'true' }}
# Trusted Publisher (OIDC) needs npm CLI >= 11.5.1; Node 22 ships
# with npm 10.x. Run the modern CLI via `npx` from its separate
# cache instead of `npm install -g npm@latest`, which races against
# the running npm mid-install ("Cannot find module 'promise-retry'").
# npm 11+ also requires an explicit --tag for prereleases.
- name: Publish to npm
if: ${{ steps.release.outputs.releases_created == 'true' }}
run: |
version=$(node -p "require('./package.json').version")
if [[ "$version" == *-* ]]; then
tag="${version#*-}"
tag="${tag%%.*}"
npx -y npm@latest publish --provenance --access public --tag "$tag"
else
npx -y npm@latest publish --provenance --access public
fi