Skip to content

Commit

Permalink
fix: added npm credentials config
Browse files Browse the repository at this point in the history
  • Loading branch information
manchenkoff committed Apr 30, 2024
1 parent c877a12 commit 51d76ef
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish latest release to NPM

env:
node_version: 20.x
package_manager: yarn # or npm
install_command: yarn install # or npm ci
script_command: yarn # or npm run
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NODE_REGISTRY: 'https://registry.npmjs.org' # setup credentials

on:
workflow_dispatch: # manual trigger

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
cache: ${{ env.package_manager }}
registry-url: ${{ env.NODE_REGISTRY }}

- name: Install dependencies
run: ${{ env.install_command }}

- name: Validate package
run: ${{ env.script_command }} validate

- name: Build package
run: ${{ env.script_command }} prepack

- name: Publish package
run: |
${{ env.script_command }} changelogen --publish
6 changes: 4 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Release new version to NPM
name: Publish new version to NPM

env:
node_version: 20.x
package_manager: yarn # or npm
install_command: yarn install # or npm ci
script_command: yarn # or npm run
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
NODE_REGISTRY: 'https://registry.npmjs.org' # setup credentials

on:
workflow_dispatch: # manual trigger
Expand All @@ -27,6 +28,7 @@ jobs:
with:
node-version: ${{ env.node_version }}
cache: ${{ env.package_manager }}
registry-url: ${{ env.NODE_REGISTRY }}

- name: Install dependencies
run: ${{ env.install_command }}
Expand All @@ -37,7 +39,7 @@ jobs:
- name: Build package
run: ${{ env.script_command }} prepack

- name: Generate changelog
- name: Generate changelog and publish package
run: |
git config --global user.name "changelog_action"
git config --global user.email "artem@manchenkoff.me"
Expand Down

0 comments on commit 51d76ef

Please sign in to comment.