@@ -16,14 +16,10 @@ concurrency:
1616 cancel-in-progress : false
1717
1818jobs :
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
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
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
0 commit comments