-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (69 loc) · 1.83 KB
/
ci-cd-develop.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
# adapted from https://github.com/dokku/github-action/blob/db5e3b84461e5e73c56d8b0f6a67aab0df25256c/example-workflows/simple.yml
name: "CI/CD"
on:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Clone repo (shallow)
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn install
- name: Run linter
run: yarn lint
test:
runs-on: ubuntu-latest
steps:
- name: Clone repo (shallow)
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test
build:
runs-on: ubuntu-latest
steps:
- name: Clone repo (shallow)
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn build
deploy:
runs-on: ubuntu-latest
needs:
- lint
- test
- build
if: ${{ github.ref == 'refs/heads/develop' }}
steps:
- name: Cloning repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@master
with:
branch: develop
# only extracting the server address to a secret avoids leaking it in the logs
git_remote_url: ssh://dokku@${{ secrets.DOKKU_SERVER_ADDRESS }}/toolbox-frontend-staging
ssh_private_key: ${{ secrets.DOKKU_DEPLOYMENT_KEY }}