-
-
Notifications
You must be signed in to change notification settings - Fork 63
55 lines (48 loc) · 1.43 KB
/
install-ztnet.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
name: Deploy to install.ztnet.network
# Controls when the workflow will run
on:
push:
branches:
- main
paths:
- 'install.ztnet/**'
workflow_dispatch:
env:
LAST_UPDATED: ${{ github.event.head_commit.timestamp }}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
prepear:
# The type of runner that the job will run on
runs-on: [self-hosted, ztnet.installer]
defaults:
run:
working-directory: install.ztnet
steps:
- uses: actions/checkout@v2
with:
clean: false
- name: Enviorment
run: |
touch .env
echo NODE_ENV="production" > .env
echo NODE_MAILER_USER="${{ secrets.NODE_MAILER_USER }}" >> .env
echo NODE_MAILER_PASSWORD="${{ secrets.NODE_MAILER_PASSWORD }}" >> .env
- name: install dependencies
run: npm install
deploy:
runs-on: [self-hosted, ztnet.installer]
defaults:
run:
working-directory: install.ztnet
needs: prepear
steps:
- name: Update Installer Script
run: |
sed -i "s/^INSTALLER_LAST_UPDATED=.*$/INSTALLER_LAST_UPDATED=${{ env.LAST_UPDATED }}/" bash/ztnet.sh
- name: Build Application
run: npm run build
- name: Restart Server
run: pm2 restart ecosystem.config.js
- name: Sleep 10sec
run: sleep 10s