-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (128 loc) · 4.08 KB
/
Copy pathpublish.yml
File metadata and controls
159 lines (128 loc) · 4.08 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Publish
on:
push:
tags:
- "v*"
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false
jobs:
preflight:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Setup Deno
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2
with:
deno-version: v2.6.8
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
- name: Verify tag matches deno.json version
shell: bash
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
if [[ ! "${tag}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag '${tag}' is not a stable semantic version."
exit 1
fi
deno_version="$(deno eval 'console.log(JSON.parse(Deno.readTextFileSync("deno.json")).version)')"
if [[ "${tag}" != "v${deno_version}" ]]; then
echo "Tag '${tag}' does not match deno.json version '${deno_version}'."
exit 1
fi
- name: Run checks
run: deno task check
- name: Verify JSR package
run: deno publish --dry-run
- name: Build npm package
run: deno task build:npm
- name: Smoke test npm entry points
run: >-
node --input-type=module -e
'await Promise.all([
import("./npm/esm/mod.js"),
import("./npm/esm/src/nondeterministic.js"),
import("./npm/esm/src/perf.js")
])'
- name: Verify npm package contents
run: npm pack ./npm --dry-run
publish-jsr:
runs-on: ubuntu-latest
needs: preflight
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Setup Deno
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2
with:
deno-version: v2.6.8
- name: Publish to JSR
run: deno publish
publish-npm:
runs-on: ubuntu-latest
needs: publish-jsr
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Setup Deno
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2
with:
deno-version: v2.6.8
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
package-manager-cache: false
- name: Build npm package
run: deno task build:npm
- name: Publish to npm
run: npm publish ./npm --access public
github-release:
runs-on: ubuntu-latest
needs: [publish-jsr, publish-npm]
permissions:
contents: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
fetch-depth: 0
- name: Generate changelog
shell: bash
run: |
set -euo pipefail
tag="${GITHUB_REF_NAME}"
prev_tag="$(
git tag --list "v*" --sort=-version:refname \
| grep -v "^${tag}$" \
| head -n 1 || true
)"
{
echo "# ${tag}"
echo
if [[ -n "${prev_tag}" ]]; then
echo "Changes since ${prev_tag}:"
echo
git log --no-merges --pretty=format:"- %s (%h)" "${prev_tag}..${tag}"
else
echo "Changes:"
echo
git log --no-merges --pretty=format:"- %s (%h)" "${tag}"
fi
echo
} > RELEASE_NOTES.md
- name: Create GitHub release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
body_path: RELEASE_NOTES.md