feat: smartly choose which server to connect to #35
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: rebuild-server | |
on: | |
push: | |
branches: ['main'] | |
paths: ['3d-pixels-server/**', 'www/**'] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: executing remote ssh commands using password | |
uses: appleboy/ssh-action@v1.0.0 | |
with: | |
host: 52.90.117.251 | |
username: ec2-user | |
key: ${{ secrets.EC2 }} | |
port: 22 | |
script: | | |
[ -d "web-3d-pixels" ] || git clone https://github.com/BlenMiner/web-3d-pixels.git | |
cd "web-3d-pixels/3d-pixels-server" | |
git reset --hard @{u} | |
git clean -df | |
git pull | |
sudo killall -9 3d-pixels-server | |
dotnet build --property:Configuration=Release | |
sudo nohup ./bin/Release/net6.0/3d-pixels-server ${{ secrets.OAUTH_CLIENT_ID }} ${{ secrets.OAUTH_SECRET }} > /dev/null 2>&1 & | |
exit |