-
-
Notifications
You must be signed in to change notification settings - Fork 9
131 lines (131 loc) · 4.7 KB
/
Copy pathrelease.yml
File metadata and controls
131 lines (131 loc) · 4.7 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
# author: elliot-huffman
name: release
on:
push:
tags:
- "*"
permissions:
id-token: write
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version: 24.x
registry-url: https://registry.npmjs.org/
- uses: actions/setup-go@v5
with:
go-version-file: packages/ttsc/go.mod
cache-dependency-path: packages/ttsc/go.sum
- uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build all packages
run: pnpm run build
- name: Assert dist/ttsc.wasm exists and is >10MB
run: |
test -f packages/wasm/dist/ttsc.wasm
size=$(stat -c%s packages/wasm/dist/ttsc.wasm)
if [ "$size" -le 10485760 ]; then
echo "packages/wasm/dist/ttsc.wasm is suspiciously small ($size bytes); aborting publish"
exit 1
fi
- name: Assert @ttsc/lint tarball ships linthost/
run: |
(cd packages/lint && pnpm pack --pack-destination /tmp)
tar -tzf /tmp/ttsc-lint-*.tgz | grep -q linthost/
- name: Smoke @ttsc/vscode packed install shim
run: SKIP_BUILD=1 DRY_RUN=1 bash scripts/publish-vscode.sh
- name: Assert Linux platform binaries carry release metadata
run: |
ttsc_version="$(node -p "require('./packages/ttsc-linux-x64/package.json').version")"
ttsc_out="$(packages/ttsc-linux-x64/bin/ttsc --version)"
server_out="$(packages/ttsc-linux-x64/bin/ttscserver --version)"
echo "$ttsc_out"
echo "$server_out"
printf '%s\n%s\n' "$ttsc_out" "$server_out" | grep -q "$ttsc_version"
! printf '%s\n%s\n' "$ttsc_out" "$server_out" | grep -q '0.0.0-dev'
! printf '%s\n%s\n' "$ttsc_out" "$server_out" | grep -q 'commit dev'
- name: Publish VS Code Marketplace extension
run: SKIP_BUILD=1 bash scripts/publish-vscode-marketplace.sh
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Publish to npm
run: pnpm run package:latest:publish
wasm-smoke:
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/setup-node@v6
with:
node-version: 24.x
registry-url: https://registry.npmjs.org/
- name: Smoke-install @ttsc/wasm from the registry
run: |
mkdir -p /tmp/ttsc-wasm-smoke
cd /tmp/ttsc-wasm-smoke
npm init -y
# Resolve the just-published version from the tag (refs/tags/<v>).
VERSION="${GITHUB_REF_NAME#v}"
npm install "@ttsc/wasm@${VERSION}"
node -e "if(!require('@ttsc/wasm'))process.exit(1)"
vscode-smoke:
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6
with:
node-version: 24.x
registry-url: https://registry.npmjs.org/
- name: Smoke-install @ttsc/vscode from the registry
run: |
mkdir -p /tmp/ttsc-vscode-smoke
cd /tmp/ttsc-vscode-smoke
npm init -y
VERSION="${GITHUB_REF_NAME#v}"
export VERSION
npm install "@ttsc/vscode@${VERSION}"
node "$GITHUB_WORKSPACE/scripts/assert-vscode-package.cjs" node_modules/@ttsc/vscode
fake_bin="$(mktemp -d)"
cat > "$fake_bin/code" <<'SH'
#!/usr/bin/env bash
printf '%s\n' "$@" > "$FAKE_CODE_ARGS"
SH
chmod +x "$fake_bin/code"
export FAKE_CODE_ARGS="$PWD/code-args.txt"
PATH="$fake_bin:$PATH" node_modules/.bin/ttsc-vscode install
node <<'NODE'
const fs = require("node:fs");
const path = require("node:path");
const version = process.env.VERSION;
const args = fs.readFileSync(process.env.FAKE_CODE_ARGS, "utf8").trim().split("\n");
const expected = path.join(
process.cwd(),
"node_modules",
"@ttsc",
"vscode",
"dist",
`ttsc-vscode-${version}.vsix`,
);
const want = ["--install-extension", expected, "--force"];
if (JSON.stringify(args) !== JSON.stringify(want)) {
throw new Error(`unexpected code args: ${JSON.stringify(args)} !== ${JSON.stringify(want)}`);
}
NODE
release:
runs-on: ubuntu-latest
needs: [wasm-smoke, vscode-smoke]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- run: pnpm dlx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}