Skip to content

Commit 1b4e0b9

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

3 files changed

Lines changed: 16 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -167,37 +167,29 @@ 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
185177

186-
- run: npm install -g npm@latest # For trusted publishing support
178+
- name: 'Setup npm'
179+
run: |
180+
npm install -g npm@latest
181+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
182+
env:
183+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
187184

188185
- name: Publish native addons
189186
run: |
190-
echo '@voidzero-dev:registry=https://npm.pkg.github.com/' >> ~/.npmrc
191187
pnpm --filter=vite-plus publish-native
192188
pnpm --filter=vite-plus-cli publish-native
193-
env:
194-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195189
196190
- name: Publish
197191
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
202-
env:
203-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
192+
pnpm publish --filter=./packages/core --access public --no-git-checks
193+
pnpm publish --filter=./packages/test --access public --no-git-checks
194+
pnpm publish --filter=./packages/cli --access public --no-git-checks
195+
pnpm publish --filter=./packages/global --access public --no-git-checks

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)