Skip to content

Commit bf7cb70

Browse files
committed
ci(release): prepare public design package publishing
1 parent 9d8e38b commit bf7cb70

6 files changed

Lines changed: 117 additions & 7 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
steps:
4646
- name: Check out repository
4747
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
48+
with:
49+
persist-credentials: false
4850

4951
- name: Set up Node
5052
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Publish Package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dist_tag:
7+
description: npm dist-tag
8+
required: true
9+
default: next
10+
type: choice
11+
options:
12+
- next
13+
- latest
14+
15+
concurrency:
16+
group: putio-design-publish-package
17+
cancel-in-progress: false
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
publish:
24+
if: github.ref == 'refs/heads/main'
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 20
27+
environment:
28+
name: release
29+
url: https://www.npmjs.com/package/@putdotio/design
30+
permissions:
31+
contents: read
32+
id-token: write
33+
steps:
34+
- name: Check out repository
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
with:
37+
persist-credentials: false
38+
39+
- name: Set up Node
40+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0
41+
with:
42+
node-version-file: .node-version
43+
registry-url: https://registry.npmjs.org
44+
45+
- name: Set up pnpm
46+
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
47+
with:
48+
cache: false
49+
50+
- name: Install dependencies
51+
run: pnpm install --frozen-lockfile
52+
53+
- name: Verify package and design system
54+
run: pnpm verify:full
55+
56+
- name: Validate package version
57+
env:
58+
PACKAGE_NAME: "@putdotio/design"
59+
run: |
60+
set -euo pipefail
61+
package_version="$(node -p "JSON.parse(fs.readFileSync('package.json', 'utf8')).version")"
62+
if [ "$package_version" = "0.0.0" ] || [ "$package_version" = "0.0.0-development" ]; then
63+
echo "Refusing to publish placeholder version $package_version"
64+
exit 1
65+
fi
66+
if npm view "$PACKAGE_NAME@$package_version" version >/dev/null 2>&1; then
67+
echo "$PACKAGE_NAME@$package_version is already published"
68+
exit 1
69+
fi
70+
echo "Publishing $PACKAGE_NAME@$package_version with dist-tag ${{ inputs.dist_tag }}"
71+
72+
- name: Publish to npm
73+
run: npm publish --provenance --access public --tag "${{ inputs.dist_tag }}"

.github/workflows/verify.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches:
77
- main
88
paths:
9-
- ".github/workflows/verify.yml"
9+
- ".github/workflows/**"
1010
- ".htmlvalidate.json"
1111
- ".node-version"
1212
- "DESIGN.md"
@@ -36,6 +36,8 @@ jobs:
3636
steps:
3737
- name: Check out repository
3838
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39+
with:
40+
persist-credentials: false
3941

4042
- name: Set up Node
4143
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ This repo owns the public contract behind it: DTCG token sources, generated CSS/
2020

2121
Token sources live in [`tokens`](tokens). Generated package artifacts live in [`dist`](dist).
2222

23+
```bash
24+
npm install @putdotio/design
25+
```
26+
2327
Common entrypoints:
2428

2529
- CSS custom properties: [`dist/css/tokens.css`](dist/css/tokens.css)

docs/DISTRIBUTION.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Distribution
22

33
`putio-design` ships two public surfaces: the static design guide at
4-
`design.put.io` and optional package artifacts from `@putdotio/design`.
4+
`design.put.io` and package artifacts from `@putdotio/design`.
55

66
## Static Site
77

@@ -16,9 +16,8 @@ The deploy workflow must run `pnpm verify` before publishing the site.
1616

1717
## Package Artifacts
1818

19-
The package stays private until an explicit publishing decision is made. Its
20-
exports are prepared so a future public npm release can expose the same generic
21-
surfaces without redesigning the repo:
19+
`@putdotio/design` is a public scoped npm package. It exposes generic token
20+
artifacts and the design contract only:
2221

2322
- `@putdotio/design/css`
2423
- `@putdotio/design/tokens`
@@ -31,6 +30,19 @@ Do not publish platform-native outputs from this repo in v1. Web, iOS, Android,
3130
Roku, and TV repos should consume the generic token artifacts and own their
3231
platform adapters.
3332

33+
Package publishing uses the manual `Publish Package` GitHub Actions workflow.
34+
The workflow runs `pnpm verify:full`, publishes with npm provenance, and expects
35+
npm Trusted Publishing to be configured for the `release` GitHub Environment.
36+
Use the `next` dist-tag for pre-release or adoption-test packages, and `latest`
37+
only for a release that should become the default npm install target.
38+
39+
Before the first publish, an npm maintainer must trust this workflow for the
40+
package:
41+
42+
```bash
43+
npx -y npm@^11.10.0 trust github @putdotio/design --repo putdotio/putio-design --file publish-package.yml --env release --allow-publish --yes
44+
```
45+
3446
## Generated Files
3547

3648
Token sources live in `tokens/**/*.tokens.json`. Generated files are checked in

package.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
{
22
"name": "@putdotio/design",
3-
"version": "0.0.0",
4-
"private": true,
3+
"version": "0.1.0-alpha.0",
4+
"description": "Public put.io design tokens, generated token artifacts, and design-system guidance.",
55
"license": "MIT",
66
"type": "module",
7+
"homepage": "https://design.put.io",
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/putdotio/putio-design.git"
11+
},
12+
"bugs": {
13+
"url": "https://github.com/putdotio/putio-design/issues"
14+
},
15+
"keywords": [
16+
"putio",
17+
"design-system",
18+
"design-tokens",
19+
"dtcg"
20+
],
21+
"publishConfig": {
22+
"access": "public"
23+
},
724
"files": [
825
"DESIGN.md",
926
"dist",

0 commit comments

Comments
 (0)