Update new-publish.yml #19
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
name: Node.js Package | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
get-package-name: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "14" | |
- name: Extract package name | |
id: get-package-name | |
run: | | |
PACKAGE_NAME=$(node -e "console.log(require('./package.json').name)") | |
echo "::set-output name=name::$PACKAGE_NAME" | |
echo "Package name is: $PACKAGE_NAME" | |
publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: "https://registry.npmjs.org" | |
- run: npm run build | |
# - run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-github: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Display package name | |
run: | | |
echo "Package name is: ${{ needs.get-package-name.outputs.name }}" | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
registry-url: https://npm.pkg.github.com/ | |
scope: "@appsaeed" # Update the scope if necessary | |
- run: npm config set registry https://npm.pkg.github.com | |
- run: npm run build | |
- run: npm publish --access public --name @appsaeed/${{ needs.get-package-name.outputs.name }} | |
# - run: npm publish npm publish --name @${github.repository_owner}/utilies | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |