-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (57 loc) · 1.63 KB
/
deploy.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
name: Deploy
on:
push:
branches:
- master
- main
jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false
matrix:
node-version: [ 16.16 ]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Copy .env file
run: 'echo "$ENV_FILE" > ./.env'
shell: bash
env:
ENV_FILE: ${{ secrets.CICD_ENV_FILE }}
- run: npm ci
- run: npm test
deploy:
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
- name: Copy .env file
run: 'echo "$ENV_FILE" > ./.env'
shell: bash
env:
ENV_FILE: ${{ secrets.PRODUCTION_ENV_FILE }}
- name: Install NPM packages
run: npm ci
- name: Build
run: npm run build
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- name: Add Server To Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Publish files
run: scp -r dist/* ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:/var/www/tp.arendz.nl/dist
- name: Restart Themeparks Server
run: ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} pm2 reload themeparkplanner-api