Skip to content

Commit feb9861

Browse files
committed
ci: publish to npm
1 parent 6dd6efd commit feb9861

4 files changed

Lines changed: 77 additions & 13 deletions

File tree

.github/workflows/publish.yml

Lines changed: 62 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@ concurrency:
1616
cancel-in-progress: false
1717

1818
jobs:
19-
publish:
19+
build:
2020
runs-on: ubuntu-latest
21-
name: Publish to GitHub Packages
22-
# Only run for v* tags or manual dispatch
21+
name: Build and test
2322
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'v')
24-
permissions:
25-
contents: read
26-
packages: write
2723

2824
steps:
2925
- name: Checkout repository
@@ -36,8 +32,6 @@ jobs:
3632
with:
3733
node-version: "22"
3834
cache: "pnpm"
39-
registry-url: "https://npm.pkg.github.com"
40-
scope: "@tampadevs"
4135

4236
- name: Install dependencies
4337
run: pnpm install --frozen-lockfile
@@ -52,11 +46,9 @@ jobs:
5246
id: version
5347
run: |
5448
if [ "${{ github.event_name }}" = "release" ]; then
55-
# Use release tag version (strip leading 'v')
5649
VERSION="${{ github.event.release.tag_name }}"
5750
VERSION="${VERSION#v}"
5851
else
59-
# CalVer: 0.YYYYMMDD.HHMM
6052
VERSION="0.$(date -u +'%Y%m%d.%H%M')"
6153
fi
6254
echo "version=$VERSION" >> $GITHUB_OUTPUT
@@ -69,10 +61,67 @@ jobs:
6961
mv tmp.json "$pkg"
7062
done
7163
72-
- name: Configure npm for GitHub Packages
64+
- name: Upload build artifacts
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: packages
68+
path: packages/
69+
70+
publish-npm:
71+
runs-on: ubuntu-latest
72+
name: Publish to npm
73+
needs: build
74+
permissions:
75+
contents: read
76+
id-token: write
77+
78+
steps:
79+
- name: Download build artifacts
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: packages
83+
path: packages/
84+
85+
- name: Setup Node.js for npm
86+
uses: actions/setup-node@v6
87+
with:
88+
node-version: "24"
89+
90+
- name: Publish packages (dry run)
91+
if: inputs.dry_run == true
92+
run: |
93+
cd packages/tokens && npm publish --access public --dry-run
94+
cd ../react && npm publish --access public --dry-run
95+
cd ../tailwind-preset && npm publish --access public --dry-run
96+
97+
- name: Publish packages
98+
if: inputs.dry_run != true
7399
run: |
74-
echo "@tampadevs:registry=https://npm.pkg.github.com" >> .npmrc
75-
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
100+
cd packages/tokens && npm publish --access public
101+
cd ../react && npm publish --access public
102+
cd ../tailwind-preset && npm publish --access public
103+
104+
publish-github:
105+
runs-on: ubuntu-latest
106+
name: Publish to GitHub Packages
107+
needs: build
108+
permissions:
109+
contents: read
110+
packages: write
111+
112+
steps:
113+
- name: Download build artifacts
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: packages
117+
path: packages/
118+
119+
- name: Setup Node.js for GitHub Packages
120+
uses: actions/setup-node@v4
121+
with:
122+
node-version: "22"
123+
registry-url: "https://npm.pkg.github.com"
124+
scope: "@tampadevs"
76125

77126
- name: Publish packages (dry run)
78127
if: inputs.dry_run == true

packages/react/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
"optional": true
5353
}
5454
},
55+
"repository": {
56+
"type": "git",
57+
"url": "https://github.com/TampaDevs/tampadevs-design.git",
58+
"directory": "packages/react"
59+
},
5560
"publishConfig": {
5661
"access": "public"
5762
}

packages/tailwind-preset/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
"peerDependencies": {
2626
"tailwindcss": "^4.0.0"
2727
},
28+
"repository": {
29+
"type": "git",
30+
"url": "https://github.com/TampaDevs/tampadevs-design.git",
31+
"directory": "packages/tailwind-preset"
32+
},
2833
"publishConfig": {
2934
"access": "public"
3035
}

packages/tokens/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
"style-dictionary": "^4.2.0",
2626
"typescript": "^5.7.0"
2727
},
28+
"repository": {
29+
"type": "git",
30+
"url": "https://github.com/TampaDevs/tampadevs-design.git",
31+
"directory": "packages/tokens"
32+
},
2833
"publishConfig": {
2934
"access": "public"
3035
}

0 commit comments

Comments
 (0)