-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (79 loc) · 2.55 KB
/
main.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
74
75
76
77
78
79
80
81
82
83
on:
pull_request_target:
push:
branches-ignore:
- "dependabot/**"
env:
CI: true
jobs:
init:
if: "! contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: brad-jones/actions/[email protected]
with:
token: ${{ secrets.CANCEL_GITHUB_TOKEN }}
# TODO: get some tests running here
# test:
# needs: init
# runs-on: ubuntu-latest
# steps:
# - name: Get Git SHA
# id: gitRef
# run: |
# if [ "${{ github.event_name }}" == 'pull_request_target' ]; then
# echo "::set-output name=sha::${{ github.event.pull_request.head.sha }}"
# else
# echo "::set-output name=sha::${{ github.sha }}"
# fi
# - name: Checkout code
# uses: actions/[email protected]
# with:
# ref: ${{ steps.gitRef.outputs.sha }}
# - name: Read .go-version
# run: echo ::set-output name=GO_VERSION::$(cat .go-version | xargs)
# id: gvm
# - uses: actions/[email protected]
# with:
# go-version: ${{ steps.gvm.outputs.GO_VERSION }}
# - name: Restore go cache
# uses: actions/[email protected]
# with:
# path: ~/go/pkg/mod
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
# restore-keys: ${{ runner.os }}-go-
# - run: go test -v ./...
release:
if: "! contains(github.event_name, 'pull_request')"
needs: init
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.CANCEL_GITHUB_TOKEN }}
steps:
- uses: actions/[email protected]
- name: Read .go-version
run: echo ::set-output name=GO_VERSION::$(cat .go-version | xargs)
id: gvm
- uses: actions/setup-go@v2
with:
go-version: ${{ steps.gvm.outputs.GO_VERSION }}
- name: Read .node-version
run: echo ::set-output name=NODE_VERSION::$(cat .node-version | xargs)
id: nvm
- uses: actions/[email protected]
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Restore go cache
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Restore node cache
uses: actions/[email protected]
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: npm ci
- run: npx semantic-release