-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (120 loc) · 4.4 KB
/
Copy pathrelease.yml
File metadata and controls
124 lines (120 loc) · 4.4 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
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "npm-v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
inputs:
release_tag:
description: Existing SemVer release tag
required: true
type: string
registry:
description: Registry publish job to retry
required: true
type: choice
options:
- npm
- jsr
- both
permissions:
contents: read
jobs:
publish-npm:
if: github.event_name == 'push' || inputs.registry == 'npm' || inputs.registry == 'both'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: npm
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
ref: ${{ inputs.release_tag || github.ref }}
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version: 1.3.14
- uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed
with:
deno-version: 2.9.2
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
with:
node-version: 24.18.0
registry-url: https://registry.npmjs.org
- run: npm install --global npm@12.0.1
- run: bun install --frozen-lockfile
- run: bun audit --audit-level=high
- run: bun run check
- run: bun run check:versions
- run: bun run check:docs
- run: bun run test:coverage
- run: bun run build
- run: node --input-type=module --eval 'const mod = await import("./dist/index.js"); if (typeof mod.TypeTypeMsePlayer !== "function") process.exit(1)'
- name: Verify release version
env:
RELEASE_TAG: ${{ inputs.release_tag || github.ref_name }}
run: |
git show-ref --verify --quiet "refs/tags/$RELEASE_TAG"
test "v$(node --print "require('./package.json').version")" = "${RELEASE_TAG#npm-}"
- name: Check npm version
id: npm-version
run: |
version=$(node --print "require('./package.json').version")
if npm view "@typetype/mse@$version" version >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Pack release
id: pack
run: |
filename=$(npm pack --json --ignore-scripts | jq --raw-output 'if type == "array" then .[0].filename else to_entries[0].value.filename end')
test -n "$filename"
echo "filename=$filename" >> "$GITHUB_OUTPUT"
- uses: actions/attest@a1948c3f048ba23858d222213b7c278aabede763
with:
subject-path: ${{ steps.pack.outputs.filename }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: npm-package
path: ${{ steps.pack.outputs.filename }}
if-no-files-found: error
retention-days: 30
- if: steps.npm-version.outputs.exists != 'true'
run: npm publish "${{ steps.pack.outputs.filename }}" --access public --provenance
publish-jsr:
if: (github.event_name == 'push' && startsWith(github.ref_name, 'v')) || inputs.registry == 'jsr' || inputs.registry == 'both'
runs-on: [self-hosted, Linux, X64, arko, typetype]
timeout-minutes: 15
environment: jsr
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
ref: ${{ inputs.release_tag || github.ref }}
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version: 1.3.14
- uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed
with:
deno-version: 2.9.2
- run: bun install --frozen-lockfile
- run: bun audit --audit-level=high
- run: bun run check
- run: bun run check:versions
- run: bun run check:docs
- run: bun run test:coverage
- name: Verify release version
env:
RELEASE_TAG: ${{ inputs.release_tag || github.ref_name }}
run: |
git show-ref --verify --quiet "refs/tags/$RELEASE_TAG"
test "v$(node --print "require('./jsr.json').version")" = "${RELEASE_TAG#npm-}"
- run: bun run publish:jsr