Skip to content

Commit

Permalink
feat: add npm publishing to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
trezy committed Jul 12, 2024
1 parent c3587ef commit 7f066b0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: Release
name: Publish Github Release

on:
push:
branches:
- 'alpha'
- 'beta'
- 'master'
- 'main'

jobs:
release:
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
Expand All @@ -28,3 +30,6 @@ jobs:

- name: Semantic Release
run: npx semantic-release

- name: Publish to npm
run: npm publish ./dist/*.tgz --tag ${{ env.BRANCH_NAME == 'main' && 'latest' || '$BRANCH_NAME' }}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ module.exports = {
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
// '@semantic-release/npm',
'@semantic-release/github',
['@semantic-release/npm', {
npmPublish: false,
tarballDir: 'dist',
}],
['@semantic-release/github', {
assets: 'dist/*.tgz',
}],
],
};

0 comments on commit 7f066b0

Please sign in to comment.