-
Notifications
You must be signed in to change notification settings - Fork 9
131 lines (117 loc) · 4.14 KB
/
push-build-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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build and deploy
on:
push:
branches: [ master ]
# Allow manually triggering deployment
workflow_dispatch:
jobs:
build:
name: Build and deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Setup cache for NPM modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm i --no-audit
- name: Compile to JavaScript
run: npm run build
env:
CI: true
- name: Prune dependencies
run: npm prune --production
- name: Upload new binaries
uses: urielsalis/rsync-deploy@master
env:
DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SERVER_PORT: 50022
FOLDER: "bin"
ARGS: "-avh --delete"
SERVER_IP: localhost
USERNAME: ${{ secrets.REMOTE_USER }}
SERVER_DESTINATION: /home/mojiradiscordbot/mojira-discord-bot
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
RESOURCE_ID: ${{ secrets.RESOURCE_ID }}
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }}
TENANT_ID: ${{ secrets.TENANT_ID }}
BASTION_NAME: ${{ secrets.BASTION_NAME }}
- name: Upload new dependencies
uses: urielsalis/rsync-deploy@master
env:
DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SERVER_PORT: 50022
FOLDER: "node_modules"
ARGS: "-avh --delete"
SERVER_IP: localhost
USERNAME: ${{ secrets.REMOTE_USER }}
SERVER_DESTINATION: /home/mojiradiscordbot/mojira-discord-bot
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
RESOURCE_ID: ${{ secrets.RESOURCE_ID }}
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }}
TENANT_ID: ${{ secrets.TENANT_ID }}
BASTION_NAME: ${{ secrets.BASTION_NAME }}
- name: Update config
uses: urielsalis/rsync-deploy@master
env:
DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SERVER_PORT: 50022
FOLDER: "config"
ARGS: "-avh --delete --exclude='local.yml' --exclude='local-*.yml'"
SERVER_IP: localhost
USERNAME: ${{ secrets.REMOTE_USER }}
SERVER_DESTINATION: /home/mojiradiscordbot/mojira-discord-bot
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
RESOURCE_ID: ${{ secrets.RESOURCE_ID }}
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }}
TENANT_ID: ${{ secrets.TENANT_ID }}
BASTION_NAME: ${{ secrets.BASTION_NAME }}
- name: Update shell files
uses: urielsalis/rsync-deploy@master
env:
DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SERVER_PORT: 50022
FOLDER: "*.sh"
ARGS: "-avh"
SERVER_IP: localhost
USERNAME: ${{ secrets.REMOTE_USER }}
SERVER_DESTINATION: /home/mojiradiscordbot/mojira-discord-bot
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
RESOURCE_ID: ${{ secrets.RESOURCE_ID }}
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }}
TENANT_ID: ${{ secrets.TENANT_ID }}
BASTION_NAME: ${{ secrets.BASTION_NAME }}
- name: Run internal deploy script
uses: urielsalis/azure-bastion-ssh-action@master
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
RESOURCE_ID: ${{ secrets.RESOURCE_ID }}
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }}
TENANT_ID: ${{ secrets.TENANT_ID }}
BASTION_NAME: ${{ secrets.BASTION_NAME }}
with:
host: localhost
port: 50022
user: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
command: |
cd mojira-discord-bot
./restart.sh main
args: "-tt"