ci: add release.yml — on-demand deploy via workflow_dispatch

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-20 07:26:00 +01:00
parent 450e599c42
commit 7f078f5734
+71
View File
@@ -0,0 +1,71 @@
name: Release tinqs-git
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build and deploy'
required: true
default: 'tinqs/main'
restart:
description: 'Restart gitea service after deploy'
type: boolean
required: true
default: true
jobs:
deploy:
runs-on: host
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- uses: actions/setup-go@v5
with:
go-version: '1.26.2'
- uses: actions/setup-node@v4
with:
node-version: '22'
- run: npm install -g pnpm
- name: Build tinqs-git
run: TAGS="bindata sqlite sqlite_unlock_notify" make build
- name: Deploy to git.arikigame.com
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
RESTART: ${{ github.event.inputs.restart }}
run: |
mkdir -p ~/.ssh
echo "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "Deploying tinqs-git to $DEPLOY_HOST..."
scp -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no \
gitea ubuntu@$DEPLOY_HOST:/tmp/tinqs-git
ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=no \
ubuntu@$DEPLOY_HOST "
echo 'Backing up current binary...'
sudo cp /usr/local/bin/gitea /usr/local/bin/gitea.backup.\$(date +%Y%m%d-%H%M%S) || true
echo 'Stopping gitea...'
sudo systemctl stop gitea || true
echo 'Installing tinqs-git...'
sudo cp /tmp/tinqs-git /usr/local/bin/gitea
sudo chmod +x /usr/local/bin/gitea
sudo chown gitea:gitea /usr/local/bin/gitea || true
if [ '$RESTART' = 'true' ]; then
echo 'Starting gitea...'
sudo systemctl start gitea
sleep 2
sudo systemctl status gitea --no-pager
else
echo 'Restart skipped (RESTART=false). Start manually: sudo systemctl start gitea'
fi
echo 'Deploy complete.'
"