2023-11-25 18:16:53 +00:00
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
# push:
|
|
|
|
# branches: [main]
|
|
|
|
workflow_dispatch: {}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
deploy-production:
|
|
|
|
runs-on: [amd64, prod]
|
|
|
|
env:
|
2024-11-19 13:50:14 +00:00
|
|
|
NODES: node-22.rosti.cz node-23.rosti.cz node-24.rosti.cz node-25.rosti.cz node-26.rosti.cz
|
2023-11-25 18:16:53 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: deploy
|
|
|
|
run: |
|
|
|
|
echo "Building for Debian 12 .."
|
|
|
|
docker run --rm --privileged -ti -v `pwd`:/srv golang:1.21-bookworm /bin/sh -c "cd /srv && go build"
|
|
|
|
|
|
|
|
for NODE in $NODES; do
|
|
|
|
echo "\033[0;32mDeploying $NODE\033[0m"
|
|
|
|
echo "\033[1;33m.. scanning SSH keys\033[0m"
|
|
|
|
ssh -o "StrictHostKeyChecking=no" root@$NODE echo "Setting up key"
|
|
|
|
echo "\033[1;33m.. copying the binary\033[0m"
|
|
|
|
scp node-api root@$NODE:/usr/local/bin/node-api_
|
|
|
|
echo "\033[1;33m.. replacing the binary\033[0m"
|
|
|
|
ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
|
|
|
|
echo "\033[1;33m.. restarting service\033[0m"
|
|
|
|
ssh root@$NODE systemctl restart node-api
|
|
|
|
done
|
|
|
|
|