-
-
Notifications
You must be signed in to change notification settings - Fork 66
47 lines (44 loc) · 1.36 KB
/
deploy-npm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Deploy to NPM
on:
# push:
# tags:
# - '*'
jobs:
publish:
runs-on: ubuntu-latest
environment: deploy
# if Running on the default branch
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci --no-audit
- run: npm run build:lib
- name: Publish to npm
id: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
# dry-run: true
- if: steps.publish.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"
create-release:
runs-on: ubuntu-latest
# if Running on the default branch
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Get the new tag version
id: tag_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Create draft release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: true