-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (61 loc) · 1.83 KB
/
release.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Release Package
on:
release:
types: [published]
jobs:
build:
name: create release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: npm access token
run: |
npm config set @tfso:registry=https://npm.pkg.github.com --userconfig .npmrc
npm config set //npm.pkg.github.com/:_authToken=${NPM_TOKEN} --userconfig .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TFSO_TOKEN }}
- name: Update package.json
run: |
git config --global user.name '${{github.actor}}'
git config --global user.email '${{github.actor}}@users.noreply.github.com'
npm version ${{github.event.release.tag_name}} --no-git-tag-version
git add package.json
git commit -m "Update package.json version to $version"
git push origin HEAD:master
- uses: actions/setup-node@v3
with:
node-version: 18
- name: build project
run: npm ci
- name: upload artifact
uses: actions/[email protected]
with:
name: artifact
path: |
src/
index.js
package.json
README.md
publish-gpr:
name: publish to github
if: github.event.release.draft == false && github.event.release.prerelease == false
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: download artifact
uses: actions/[email protected]
with:
name: artifact
- name: setup
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
scope: "@tfso"
- name: publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}