forked from TeamInklings/Octobot
mctaylors
76214c9951
Some checks failed
Publish and deploy / Upload Octobot Stealth to production (push) Has been cancelled
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
65 lines
1.7 KiB
YAML
65 lines
1.7 KiB
YAML
name: "Publish and deploy"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "stealth"
|
|
|
|
jobs:
|
|
upload-solution:
|
|
name: Upload Octobot Stealth to production
|
|
runs-on: docker
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET 8
|
|
uses: https://github.com/actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8
|
|
|
|
- name: Publish solution
|
|
run: dotnet publish $PUBLISH_FLAGS
|
|
env:
|
|
DOTNET_NOLOGO: true
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
|
PUBLISH_FLAGS: ${{vars.PUBLISH_FLAGS}}
|
|
|
|
- name: Setup SSH key
|
|
run: |
|
|
install -m 600 -D /dev/null ~/.ssh/id_rsa
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts
|
|
shell: bash
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}}
|
|
SSH_HOST: ${{secrets.SSH_HOST}}
|
|
|
|
- name: Stop currently running instance
|
|
run: |
|
|
ssh $SSH_USER@$SSH_HOST $STOP_COMMAND
|
|
shell: bash
|
|
env:
|
|
SSH_USER: ${{secrets.SSH_USER}}
|
|
SSH_HOST: ${{secrets.SSH_HOST}}
|
|
STOP_COMMAND: ${{vars.STOP_COMMAND}}
|
|
|
|
- name: Upload published solution
|
|
run: |
|
|
scp -r $UPLOAD_FROM $SSH_USER@$SSH_HOST:$UPLOAD_TO
|
|
shell: bash
|
|
env:
|
|
SSH_USER: ${{secrets.SSH_USER}}
|
|
SSH_HOST: ${{secrets.SSH_HOST}}
|
|
UPLOAD_FROM: ${{vars.UPLOAD_FROM}}
|
|
UPLOAD_TO: ${{vars.UPLOAD_TO}}
|
|
|
|
- name: Start new instance
|
|
run: |
|
|
ssh $SSH_USER@$SSH_HOST $START_COMMAND
|
|
shell: bash
|
|
env:
|
|
SSH_USER: ${{secrets.SSH_USER}}
|
|
SSH_HOST: ${{secrets.SSH_HOST}}
|
|
START_COMMAND: ${{vars.START_COMMAND}}
|