-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(release): Update GitHub Packages publish workflow
- Change trigger from release to workflow_dispatch and tag push - Update npm registry URL for GitHub Packages - Use GITHUB_TOKEN instead of GITHUB_PUBLISH_TOKEN - Add .npmrc creation for scoped package publishing
- Loading branch information
Showing
1 changed file
with
26 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
name: Publish Package to npm | ||
name: Publish to GitHub Packages | ||
|
||
on: | ||
release: | ||
types: [created] | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
publish-gpr: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- run: npm cache clean --force | ||
- run: npm install | ||
- run: npm publish --access public | ||
node-version: '18' | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: '@gitset-dev' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Publish to GitHub Packages | ||
run: | | ||
# Crea un .npmrc temporal para esta publicación | ||
echo "@gitset-dev:registry=https://npm.pkg.github.com" > .npmrc | ||
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc | ||
npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_PUBLISH_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |