Skip to content

Update push.yml

Update push.yml #68

Workflow file for this run

# 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:
- 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 }}
- run: |
python3 -m pip install --upgrade pip --user
ARGS="-avh --delete"
USERNAME=risa
SERVER_DESTINATION=/home/risa/r-isa
SSHPATH="$HOME/.ssh"
rm -rf "$SSHPATH"
mkdir "$SSHPATH"
echo "${{ secrets.SSH_PRIVATE_KEY }}" > $SSHPATH/key
chmod 600 $SSHPATH/key
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 &
echo Wait for bastion tunnel to open
az network bastion wait --created --name ${{ secrets.BASTION_NAME }} --resource-group ${{ secrets.RESOURCE_GROUP }}
echo Upload new libraries
FOLDER=build/install/risa/lib
rsync $ARGS -e 'ssh -i $SSHPATH/key -o StrictHostKeyChecking=no -p 50022' $GITHUB_WORKSPACE/$FOLDER [email protected]:$SERVER_DESTINATION
echo Upload new binaries
FOLDER=build/install/risa/bin
rsync $ARGS $GITHUB_WORKSPACE/$FOLDER [email protected]:$SERVER_DESTINATION
echo Upload new configuration
FOLDER=risa.yml
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"