Skip to content

Commit e7e20ed

Browse files
authored
chore: Manual publish workflow (#2368)
1 parent f0317e5 commit e7e20ed

22 files changed

Lines changed: 221 additions & 26 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish release to npm
2+
on:
3+
# For manual releases
4+
workflow_dispatch:
5+
inputs:
6+
dry-run:
7+
description: Whether to perform a dry run of the publish.
8+
type: boolean
9+
default: true
10+
11+
jobs:
12+
npm-build:
13+
if: github.repository == 'software-mansion/TypeGPU'
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write
18+
id-token: write # for OIDC
19+
20+
concurrency:
21+
group: publish-${{ github.ref }}
22+
cancel-in-progress: false
23+
24+
steps:
25+
- name: Check out
26+
uses: actions/checkout@v4
27+
28+
- name: Install pnpm
29+
uses: pnpm/action-setup@v4
30+
with:
31+
run_install: false
32+
33+
- name: Use Node.js 24.x
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 24.x
37+
cache: 'pnpm'
38+
39+
- name: Install dependencies
40+
run: pnpm install --frozen-lockfile
41+
42+
- name: Publish manual release
43+
if: ${{ github.event_name == 'workflow_dispatch' }}
44+
env:
45+
DISABLE_DRY_RUN: ${{ inputs['dry-run'] == false }}
46+
run: bun scripts/publish.ts

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pnpm publish --dry-run # (if alpha, --tag alpha)
4848
> publishing:
4949
>
5050
> ```bash
51-
> SKIP_ALL_CHECKS=true pnpm publish # (if alpha, --tag alpha)
51+
> SKIP_TESTS=true pnpm publish # (if alpha, --tag alpha)
5252
> ```
5353
5454
6. Rebase _release_ branch on _main_

apps/resolution-time/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"typegpu": "workspace:*"
1212
},
1313
"devDependencies": {
14-
"bun": "1.3.10",
14+
"bun": "catalog:",
1515
"unplugin-typegpu": "workspace:*"
1616
}
1717
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@
3232
"test:browser": "vitest run --browser.enabled --project browser",
3333
"test:browser:watch": "vitest --browser.enabled --project browser",
3434
"test:coverage": "vitest --coverage run",
35-
"nightly-build": "SKIP_ALL_CHECKS=true pnpm --filter typegpu --filter @typegpu/noise --filter unplugin-typegpu prepublishOnly",
35+
"nightly-build": "SKIP_TESTS=true pnpm --filter typegpu --filter @typegpu/noise --filter unplugin-typegpu prepublishOnly --skip-publish-tag-check",
3636
"changes": "tgpu-dev-cli changes"
3737
},
3838
"devDependencies": {
3939
"@typegpu/tgpu-dev-cli": "workspace:*",
40+
"@types/bun": "^1.3.12",
4041
"@vitest/browser": "^3.2.4",
4142
"@vitest/coverage-v8": "3.1.2",
4243
"@webgpu/types": "catalog:types",
44+
"bun": "catalog:",
4345
"dpdm": "^3.14.0",
4446
"eslint-plugin-eslint-plugin": "^7.3.2",
4547
"eslint-plugin-typegpu": "workspace:*",

packages/eslint-plugin/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
}
2929
},
3030
"publishConfig": {
31+
"access": "public",
3132
"exports": {
3233
".": {
3334
"types": "./dist/index.d.mts",

packages/tgpu-dev-cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"pkg-types": "^2.1.0",
2020
"remeda": "^2.21.2"
2121
},
22+
"devDependencies": {
23+
"@types/node": "catalog:types"
24+
},
2225
"engines": {
2326
"node": ">=12.20.0"
2427
},

packages/tgpu-dev-cli/prepack.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ async function main() {
135135
'--skip-publish-tag-check': Boolean,
136136
});
137137

138-
const skipAllChecks = process.env.SKIP_ALL_CHECKS === 'true';
138+
const skipTests = process.env.SKIP_TESTS === 'true';
139139

140-
if (!args['--skip-publish-tag-check'] && !skipAllChecks) {
140+
if (!args['--skip-publish-tag-check']) {
141141
verifyPublishTag();
142142
}
143143

@@ -200,7 +200,7 @@ async function main() {
200200
// First build
201201
...(await Promise.allSettled([withStatusUpdate('build', $`pnpm build`)])),
202202
// Then the rest
203-
...(skipAllChecks
203+
...(skipTests
204204
? []
205205
: await Promise.allSettled([
206206
withStatusUpdate('style', $`pnpm -w test:style`),

packages/tgpu-dev-cli/verify-publish-tag.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// @ts-check
2+
/// <reference types="node" />
23

34
import { type } from 'arktype';
45
import { readPackageJSON } from 'pkg-types';
56

6-
const PublishTags = /** @type {const} */ (['alpha', 'beta']);
7+
const PublishTags = /** @type {const} */ (['alpha', 'beta', 'rc', 'nightly']);
78

89
const PublishTag = type.or(
910
'undefined',
@@ -16,7 +17,7 @@ const chosenPublishTag = PublishTag.assert(process.env.npm_config_tag);
1617
export function verifyPublishTag() {
1718
let tagVerified = false;
1819
for (const tag of PublishTags) {
19-
if (packageJSON.version?.includes(tag)) {
20+
if (packageJSON.version?.includes(`-${tag}.`)) {
2021
if (tag !== chosenPublishTag) {
2122
throw new Error(
2223
`Publishing under a mismatched tag "${chosenPublishTag}" for version ${packageJSON.version}. Use --tag ${tag}`,

packages/tinyest-for-wgsl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "tinyest-for-wgsl",
33
"version": "0.3.2",
4-
"private": true,
54
"description": "Transforms JavaScript into its 'tinyest' form, to be used in generating equivalent (or close to) WGSL code.",
65
"keywords": [
76
"compute",
@@ -28,6 +27,7 @@
2827
"sideEffects": false,
2928
"exports": "./src/index.ts",
3029
"publishConfig": {
30+
"access": "public",
3131
"directory": "dist",
3232
"exports": {
3333
"./package.json": "./package.json",

packages/tinyest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "tinyest",
33
"version": "0.3.1",
4-
"private": true,
54
"description": "A compact, fast, and embeddable JavaScript AST for transpilation.",
65
"keywords": [
76
"ast",
@@ -20,6 +19,7 @@
2019
"sideEffects": false,
2120
"exports": "./src/index.ts",
2221
"publishConfig": {
22+
"access": "public",
2323
"directory": "dist",
2424
"exports": {
2525
"./package.json": "./package.json",

0 commit comments

Comments
 (0)