add autodeployment for secondary server #1
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: Deploy Component | |
on: | |
workflow_call: | |
jobs: | |
init-update: | |
runs-on: ubuntu-latest | |
env: | |
TARGET: DINO | |
SPRING_BOOT_ADMIN_USERNAME: ${{ secrets.SPRING_BOOT_ADMIN_USERNAME }} | |
SPRING_BOOT_ADMIN_PASSWORD: ${{ secrets.SPRING_BOOT_ADMIN_PASSWORD }} | |
SERVER_VOLUME_DIR: ${{ secrets.SERVER_VOLUME_DIR}} | |
ENV_FILES: service_config/files | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare deployment | |
run: bash -c ./service_config/prepare_deployment.sh | |
- name: "Deploy on DINO" | |
if: ${{ env.TARGET == 'DINO' }} | |
# ssh into server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets. SERVER_HOST }} | |
port : ${{ secrets.SERVER_PORT }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
# replace server-specific volume dirs | |
run: sed -i "s/VOLUME_DIR/$SERVER_VOLUME_DIR/g" ./service_config/service_config.json | |
run: bash -c ./service_config/deploy_components.sh ./service_config/service_config.json | |
# use MSU to update on SWE | |
- name: "Deploy on SWE" | |
if: ${{ env.TARGET == 'SWE' }} | |
# TODO: replace with specific dir | |
run: sed -i "s/VOLUME_DIR/$SERVER_VOLUME_DIR/g" ./service_config/service_config.json | |
uses: WSE-research/[email protected] | |
with: | |
api_key: ${{ secrets.API_KEY }} | |
updater_host: ${{ secrets.UPDATER_HOST }} | |