-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use azure/cli action for deploy script
- Loading branch information
1 parent
76c0db6
commit a26cd3c
Showing
1 changed file
with
96 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,71 +35,104 @@ jobs: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
- 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 }} | ||
- name: Open Bastion tunnel and deploy | ||
uses: azure/cli@v2 | ||
with: | ||
host: localhost | ||
port: 50022 | ||
user: risa | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
command: | | ||
azcliversion: latest | ||
inlineScript: | | ||
SERVER_PORT=5022 | ||
ARGS=-avh --delete | ||
USERNAME=risa | ||
SERVER_DESTINATION=/home/risa/r-isa | ||
echo Opening tunnel | ||
az network bastion tunnel --name $BASTION_NAME --resource-group $RESOURCE_GROUP --target-resource-id $RESOURCE_ID --resource-port 22 --port $SERVER_PORT & | ||
echo Wait for bastion tunnel to open | ||
az network bastion wait --created --name $BASTION_NAME --resource-group $RESOURCE_GROUP | ||
echo Upload new libraries | ||
FOLDER=build/install/risa/lib | ||
rsync $ARGS 50022 $GITHUB_WORKSPACE/$FOLDER [email protected]:$SERVER_DESTINATION | ||
echo Upload new binaries | ||
FOLDER=build/install/risa/bin | ||
rsync $ARGS 50022 $GITHUB_WORKSPACE/$FOLDER [email protected]:$SERVER_DESTINATION | ||
echo Upload new configuration | ||
FOLDER=risa.yml | ||
rsync $ARGS 50022 $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' | ||
args: "-tt" | ||
# - 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" |