-
Notifications
You must be signed in to change notification settings - Fork 673
57 lines (52 loc) · 1.39 KB
/
publish.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
---
name: Build and Publish
on:
push:
branches:
- main
jobs:
test:
name: Build & Test
uses: ./.github/workflows/build-and-test.workflow.yml
publish:
runs-on: ubuntu-latest
needs: test
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup env
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}
# Publish to NPM
- name: Publish if version has been updated
uses: pascalgn/[email protected]
with:
tag_name: 'v%s'
tag_message: 'v%s'
commit_pattern: "^Release (\\S+)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.npm_token }}
# Publish to Github PKG
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: 'https://npm.pkg.github.com'
- name: Publish to Github PKG if version has been updated
uses: pascalgn/[email protected]
with:
create_tag: false
commit_pattern: "^Release (\\S+)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}