-
Notifications
You must be signed in to change notification settings - Fork 1
146 lines (134 loc) · 5.28 KB
/
push.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# This workflow will build a Java project with Gradle and deploy it
name: Build and push
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: |
apt install rsync
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
uses: eskatos/[email protected]
with:
arguments: clean build installDist
wrapper-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Open Bastion tunnel
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az config set extension.dynamic_install_allow_preview=true
echo Opening tunnel
az network bastion tunnel --name ${{ secrets.BASTION_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --target-resource-id ${{ secrets.RESOURCE_ID }} --resource-port 22 --port 50022 --debug &
echo Wait for bastion tunnel to open
az network bastion wait --created --name ${{ secrets.BASTION_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }} --debug
- name: Deploy
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
ARGS="-avh --delete"
USERNAME=risa
SERVER_DESTINATION=/home/risa/r-isa
echo Upload new libraries
FOLDER=build/install/risa/lib
sh -c "rsync $ARGS $GITHUB_WORKSPACE/$FOLDER [email protected]:$SERVER_DESTINATION"
echo Upload new binaries
FOLDER=build/install/risa/bin
sh -c "rsync $ARGS $GITHUB_WORKSPACE/$FOLDER [email protected]:$SERVER_DESTINATION"
echo Upload new configuration
FOLDER=risa.yml
sh -c "rsync $ARGS $GITHUB_WORKSPACE/$FOLDER [email protected]:$SERVER_DESTINATION"
echo Run internal deploy script
/usr/bin/screen -ls | /bin/egrep 'Detached|Attached' | /usr/bin/cut -d. -f1 | /usr/bin/awk '{print $1}' | /usr/bin/xargs /bin/kill
sleep 1
cd r-isa
/usr/bin/screen -d -m bash -c '/home/risa/r-isa/bin/risa; exec sh'
# - name: Upload new libraries
# uses: urielsalis/rsync-deploy@master
# env:
# DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# SERVER_PORT: 50022
# FOLDER: "build/install/risa/lib"
# ARGS: "-avh --delete"
# SERVER_IP: localhost
# USERNAME: risa
# SERVER_DESTINATION: /home/risa/r-isa
# 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 binaries
# uses: urielsalis/rsync-deploy@master
# env:
# DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# SERVER_PORT: 50022
# FOLDER: "build/install/risa/bin"
# ARGS: "-avh --delete"
# SERVER_IP: localhost
# USERNAME: risa
# SERVER_DESTINATION: /home/risa/r-isa
# 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 configuration
# uses: urielsalis/rsync-deploy@master
# env:
# DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# SERVER_PORT: 50022
# FOLDER: "risa.yml"
# ARGS: "-avh --delete"
# SERVER_IP: localhost
# USERNAME: risa
# SERVER_DESTINATION: /home/risa/r-isa
# 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: risa
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# command: |
# /usr/bin/screen -ls | /bin/egrep 'Detached|Attached' | /usr/bin/cut -d. -f1 | /usr/bin/awk '{print $1}' | /usr/bin/xargs /bin/kill
# sleep 1
# cd r-isa
# /usr/bin/screen -d -m bash -c '/home/risa/r-isa/bin/risa; exec sh'
# args: "-tt"