This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (73 loc) · 2.27 KB
/
npm-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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
on: [push, pull_request]
name: Build
jobs:
test:
name: Build & Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ matrix.node-version }}-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Build
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Test
run: npm_config_yes=true npx best-test@latest
publish-npm:
name: Publish npm
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: 12.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Build
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Test
run: npm_config_yes=true npx best-test@latest
- name: Publish npm
uses: mikeal/merge-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# publish-github:
# name: Publish github
# needs: test
# runs-on: ubuntu-latest
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# steps:
# - uses: actions/checkout@v2
# - name: Cache node_modules
# id: cache-modules
# uses: actions/cache@v1
# with:
# path: node_modules
# key: 12.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
# - name: Build
# if: steps.cache-modules.outputs.cache-hit != 'true'
# run: npm install
# - name: Test
# run: npm_config_yes=true npx best-test@latest
# - name: Publish github
# uses: mikeal/merge-release@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_REGISTRY_URL: npm.pkg.github.com