Skip to content

Commit 1135dae

Browse files
committed
ci: publish to npm
1 parent 950d3ef commit 1135dae

3 files changed

Lines changed: 12 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,10 @@ jobs:
167167

168168
- name: Set npm packages version
169169
run: |
170-
sed -i 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/core/package.json
171-
sed -i 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/test/package.json
172-
sed -i 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/cli/package.json
173-
sed -i 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/global/package.json
174-
175-
# Setup node correctly for publishing to github registry
176-
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
177-
with:
178-
node-version-file: .node-version
179-
registry-url: 'https://npm.pkg.github.com'
180-
scope: '@voidzero-dev'
181-
package-manager-cache: false
170+
sed -i 's/"version": "0.0.0"/"version": "0.0.0+${{ github.sha }}"/' packages/core/package.json
171+
sed -i 's/"version": "0.0.0"/"version": "0.0.0+${{ github.sha }}"/' packages/test/package.json
172+
sed -i 's/"version": "0.0.0"/"version": "0.0.0+${{ github.sha }}"/' packages/cli/package.json
173+
sed -i 's/"version": "0.0.0"/"version": "0.0.0+${{ github.sha }}"/' packages/global/package.json
182174
183175
- name: Build test
184176
run: pnpm --filter=@voidzero-dev/vite-plus-test build
@@ -187,17 +179,16 @@ jobs:
187179

188180
- name: Publish native addons
189181
run: |
190-
echo '@voidzero-dev:registry=https://npm.pkg.github.com/' >> ~/.npmrc
191182
pnpm --filter=vite-plus publish-native
192183
pnpm --filter=vite-plus-cli publish-native
193184
env:
194-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
195186

196187
- name: Publish
197188
run: |
198-
pnpm publish --filter=./packages/core --registry https://npm.pkg.github.com --no-git-checks
199-
pnpm publish --filter=./packages/test --registry https://npm.pkg.github.com --no-git-checks
200-
pnpm publish --filter=./packages/cli --registry https://npm.pkg.github.com --no-git-checks
201-
pnpm publish --filter=./packages/global --registry https://npm.pkg.github.com --no-git-checks
189+
pnpm publish --filter=./packages/core --access public --no-git-checks
190+
pnpm publish --filter=./packages/test --access public --no-git-checks
191+
pnpm publish --filter=./packages/cli --access public --no-git-checks
192+
pnpm publish --filter=./packages/global --access public --no-git-checks
202193
env:
203-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
194+
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

packages/cli/publish-native-addons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ await cli.prePublish({
2929

3030
const npmDir = await readdir(join(currentDir, 'npm'));
3131
for (const file of npmDir) {
32-
execSync(`npm publish --tag latest --registry https://npm.pkg.github.com --no-git-checks`, {
32+
execSync(`npm publish --tag latest --access public --no-git-checks`, {
3333
cwd: join(currentDir, 'npm', file),
3434
env: process.env,
3535
stdio: 'inherit',

packages/global/publish-native-addons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ await cli.prePublish({
2929

3030
const npmDir = await readdir(join(currentDir, 'npm'));
3131
for (const file of npmDir) {
32-
execSync(`npm publish --tag latest --registry https://npm.pkg.github.com --no-git-checks`, {
32+
execSync(`npm publish --tag latest --access public --no-git-checks`, {
3333
cwd: join(currentDir, 'npm', file),
3434
env: process.env,
3535
stdio: 'inherit',

0 commit comments

Comments
 (0)