forked from alvarolorentedev/merge-release
-
Notifications
You must be signed in to change notification settings - Fork 4
42 lines (42 loc) · 1.07 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
name: Build, Test and maybe Publish
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: npm
cache-dependency-path: src/package-lock.json
- name: Build
run: cd src && npm install
- name: Test
run: cd src && npm test
publish:
name: Publish
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: npm
cache-dependency-path: src/package-lock.json
- name: Build
run: cd src && npm install
- name: Test
run: cd src && npm test
- name: Publish
uses: github-actions-community/merge-release@main
env:
DEPLOY_DIR: src
SRC_PACKAGE_DIR: src
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}