Allow better customisation of autodeploy through secrets and variables (#102)

The production environment and host are ready for this PR

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-09-04 22:59:30 +05:00 committed by GitHub
parent 5fd116d0e2
commit 4ccf40bf35
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,9 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Publish solution - name: Publish solution
run: dotnet publish -c Release -r linux-x64 --no-self-contained -p:PublishReadyToRun=true run: dotnet publish $PUBLISH_FLAGS
env:
PUBLISH_FLAGS: ${{vars.PUBLISH_FLAGS}}
- name: Setup SSH key - name: Setup SSH key
run: | run: |
@ -33,29 +35,30 @@ jobs:
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
SSH_HOST: ${{secrets.SSH_HOST}} SSH_HOST: ${{secrets.SSH_HOST}}
- name: Quit currently running instance - name: Stop currently running instance
continue-on-error: true
run: | run: |
ssh $SSH_USER@$SSH_HOST pkill --signal SIGQUIT Boyfriend ssh $SSH_USER@$SSH_HOST $STOP_COMMAND
shell: bash shell: bash
env: env:
SSH_USER: ${{secrets.SSH_USER}} SSH_USER: ${{secrets.SSH_USER}}
SSH_HOST: ${{secrets.SSH_HOST}} SSH_HOST: ${{secrets.SSH_HOST}}
STOP_COMMAND: ${{vars.STOP_COMMAND}}
- name: Upload published solution - name: Upload published solution
run: | run: |
scp -r bin/Release/net7.0/linux-x64/publish/* $SSH_USER@$SSH_HOST:$UPLOAD_DESTINATION scp -r $UPLOAD_FROM $SSH_USER@$SSH_HOST:$UPLOAD_TO
shell: bash shell: bash
env: env:
SSH_USER: ${{secrets.SSH_USER}} SSH_USER: ${{secrets.SSH_USER}}
SSH_HOST: ${{secrets.SSH_HOST}} SSH_HOST: ${{secrets.SSH_HOST}}
UPLOAD_DESTINATION: ${{secrets.UPLOAD_DESTINATION}} UPLOAD_FROM: ${{vars.UPLOAD_FROM}}
UPLOAD_TO: ${{vars.UPLOAD_TO}}
- name: Start uploaded solution - name: Start new instance
run: | run: |
ssh $SSH_USER@$SSH_HOST $COMMAND ssh $SSH_USER@$SSH_HOST $START_COMMAND
shell: bash shell: bash
env: env:
SSH_USER: ${{secrets.SSH_USER}} SSH_USER: ${{secrets.SSH_USER}}
SSH_HOST: ${{secrets.SSH_HOST}} SSH_HOST: ${{secrets.SSH_HOST}}
COMMAND: ${{secrets.COMMAND}} START_COMMAND: ${{vars.START_COMMAND}}