104 lines (86 loc) · 2.48 KB
/
continuous_delivery.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Continuous Delivery
on:
push:
branches: [trunk, beta]
jobs:
lint:
runs-on: ubuntu-18.04
steps:
- name: Project checkout
uses: actions/checkout@v2
- name: Node.js Setup
uses: actions/setup-node@v1
- name: Installation of Node.js dependencies
run: npm ci
- name: Lint
run: npm run lint
commit-lint:
runs-on: ubuntu-18.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Project checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v2.1.3
with:
helpURL: https://github.com/PauloGoncalvesBH/ServeRest/blob/trunk/.github/CONTRIBUTING.md
test-api:
runs-on: ubuntu-18.04
strategy:
matrix:
node: [10, 12, 14]
steps:
- name: Project checkout
uses: actions/checkout@v2
- name: Node.js v${{ matrix.node }} Setup
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Installation of Node.js dependencies
run: npm ci
- name: API Test
run: npm test
release:
needs: [lint, commit-lint, test-api]
runs-on: ubuntu-18.04
steps:
- name: Project checkout
uses: actions/checkout@v2
- name: Node.js Setup
uses: actions/setup-node@v1
with:
node-version: 12
- name: Installation of Node.js dependencies
run: npm ci
- name: Release on NPM and Docker
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
run: npx semantic-release
release-on-serverest-dev:
needs: [release]
runs-on: ubuntu-18.04
steps:
- name: Sleep for 1 minute
uses: jakejarvis/wait-action@master
with:
time: '1m'
- name: Project checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup SSH to use on 'git push umbler'
uses: shimataro/ssh-key-action@v1.5.0
with:
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
public-key: ${{ secrets.SSH_PUBLIC_KEY }}
known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Release on serverest.dev
run: |
git remote add umbler ssh://git@geonosis.deploy.umbler.com:9922/jnydrgre/serverest-dev.git
git fetch --unshallow origin
git push umbler ${GITHUB_REF##*/}:trunk --no-verify --force