forked from nick-fields/retry
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (72 loc) · 1.91 KB
/
ci_cd.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
name: CI/CD
on:
push:
branches:
- '**'
jobs:
# runs on branch pushes only
ci:
name: Run Tests
if: startsWith(github.ref, 'refs/heads')
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Test
uses: ./
continue-on-error: true
with:
timeout_minutes: 1
max_attempts: 3
command: npm install this-isnt-a-real-package-name-zzz
- name: happy-path
uses: ./
with:
timeout_minutes: 1
max_attempts: 2
command: npm -v
- name: sad-path (error)
uses: ./
continue-on-error: true
with:
timeout_minutes: 1
max_attempts: 2
command: node -e "process.exit(1)"
- name: sad-path (timeout)
uses: ./
continue-on-error: true
with:
timeout_minutes: 1
max_attempts: 2
command: node -e "(async()=>await new Promise(r => setTimeout(r, 120000)))()"
# runs on push to master only
cd:
name: Publish Action
needs: ci
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Release
id: semantic
uses: cycjimmy/semantic-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tag
run: git tag -f v${MAJOR_VERSION} && git push origin v${MAJOR_VERSION}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAJOR_VERSION: ${{ steps.semantic.outputs.new_release_major_version }}