Skip to content

Commit

Permalink
Copy npm publishing strategy from another project
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceo committed Aug 29, 2024
1 parent 9ffa91b commit 45a091b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ jobs:
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm run build
- run: npm publish

- name: Modify package.json for local context
if: steps.version.outputs.is_valid == 'true'
# Values in package.json must match the current GitHub repository to
# publish to it.
run: |
npm exec -- json -I -f package.json -e "this.name='@$GITHUB_REPOSITORY'"
npm exec -- json -I -f package.json -e "this.repository='https://github.com/$GITHUB_REPOSITORY'"
- name: Release NPM package
if: steps.version.outputs.is_valid == 'true'
# The latest tag follows tagged versions to follow NPM conventions.
run: |
npm version ${{ env.NPM_VERSION }} --no-git-tag-version
cat package.json
npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"json-to-zod": "./dist/src/cli.js"
},
"publishConfig": {
"spaceo:registry": "https://npm.pkg.github.com"
"registry": "https://npm.pkg.github.com"
},
"dependencies": {
"cosmiconfig": "^9.0.0",
Expand Down

0 comments on commit 45a091b

Please sign in to comment.