Automatically publish npm pack to GH Releases
This commit is contained in:
parent
f0ac5afc50
commit
c241f5f40e
1 changed files with 22 additions and 5 deletions
27
.github/workflows/main.yml
vendored
27
.github/workflows/main.yml
vendored
|
|
@ -2,8 +2,9 @@ on:
|
|||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
pull_request:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
@ -18,9 +19,25 @@ jobs:
|
|||
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
|
||||
- name: Verify that `npm run build` did not change outputs
|
||||
run: git diff --exit-code
|
||||
|
||||
- run: npm test
|
||||
- run: npm run lint
|
||||
|
||||
package:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'release'
|
||||
needs: build
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: npm
|
||||
|
||||
- run: npm ci
|
||||
- run: npm pack
|
||||
|
||||
- name: Upload package to release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh release upload ${{ github.event.release.tag_name }} ./*.tgz
|
||||
|
|
|
|||
Loading…
Reference in a new issue