Build and deploy #29
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
name: Build and deploy | |
on: | |
push: | |
branches: [ master ] | |
# Allow manually triggering deployment | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Set up Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Build with Gradle | |
run: ./gradlew clean installDist | |
- name: Upload new libraries | |
uses: urielsalis/rsync-deploy@master | |
env: | |
DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SERVER_PORT: 50022 | |
FOLDER: "build/install/arisa-kt/lib" | |
ARGS: "-avhW --delete" | |
SERVER_IP: localhost | |
USERNAME: arisakt | |
SERVER_DESTINATION: /home/arisakt/arisa-kt | |
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/arisa-kt/bin" | |
ARGS: "-avhW --delete" | |
SERVER_IP: localhost | |
USERNAME: arisakt | |
SERVER_DESTINATION: /home/arisakt/arisa-kt | |
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: "config" | |
ARGS: "-avhW --delete --exclude='local.yml'" | |
SERVER_IP: localhost | |
USERNAME: arisakt | |
SERVER_DESTINATION: /home/arisakt/arisa-kt | |
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: arisakt | |
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 arisa-kt | |
/usr/bin/screen -d -m bash -c '/home/arisakt/arisa-kt/bin/arisa-kt; exec sh' | |
args: "-tt" | |