handle api.smoo.it too #6
This file contains hidden or 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 | |
on: | |
push: | |
branches: | |
- 'api2' | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name : Checkout | |
uses : actions/checkout@v4 | |
- | |
name : Configure SSH | |
run : | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" >~/.ssh/api2.key | |
chmod 600 ~/.ssh/api2.key | |
cat >>~/.ssh/config <<END | |
Host api2 | |
HostName api2.smoo.it | |
User $SSH_USER | |
IdentityFile ~/.ssh/api2.key | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_USER : ${{ secrets.API2_SSH_USER }} | |
SSH_KEY : ${{ secrets.API2_SSH_KEY }} | |
- | |
name : Git pull | |
run : | | |
ssh api2 'cd api2.smoo.it/ && git restore docker-compose.yml && git pull' | |
- | |
name : Copy docker-compose.yml | |
run : | | |
scp ./docker-compose.yml api2:~/api2.smoo.it/docker-compose.yml | |
- | |
name : Build | |
run : | | |
ssh api2 'cd api2.smoo.it/ && docker compose build' | |
- | |
name : Deploy | |
run : | | |
ssh api2 'cd api2.smoo.it/ && docker compose up -d' |