Skip to content

Commit

Permalink
Use azure/cli action for deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
violine1101 authored Sep 3, 2024
1 parent 76c0db6 commit a26cd3c
Showing 1 changed file with 96 additions and 63 deletions.
159 changes: 96 additions & 63 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit a26cd3c

Please sign in to comment.