Skip to content

Commit

Permalink
chore(release): Update GitHub Packages publish workflow
Browse files Browse the repository at this point in the history
- 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
imprvhub committed Dec 31, 2024
1 parent d99b108 commit 9f3f77b
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions .github/workflows/npm_publish.yml
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 }}

0 comments on commit 9f3f77b

Please sign in to comment.