ci: S3 pipeline — build uploads to s3://tinqs-builds, release downloads by version
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,3 +22,11 @@ jobs:
|
||||
run: TAGS="bindata sqlite sqlite_unlock_notify" make build
|
||||
- name: Verify binary
|
||||
run: ls -lh gitea && echo "Build successful"
|
||||
|
||||
- name: Upload to S3
|
||||
run: |
|
||||
SHORT_SHA=$(echo "${GITHUB_SHA:-$(git rev-parse --short HEAD)}" | cut -c1-10)
|
||||
echo "Uploading tinqs-git ($SHORT_SHA) to S3..."
|
||||
aws s3 cp gitea "s3://tinqs-builds/tinqs-git/$SHORT_SHA/tinqs-git"
|
||||
aws s3 cp gitea "s3://tinqs-builds/tinqs-git/latest/tinqs-git"
|
||||
echo "OK tinqs-git ($SHORT_SHA) → s3://tinqs-builds/tinqs-git/"
|
||||
|
||||
@@ -3,10 +3,10 @@ name: Release tinqs-git
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to build and deploy'
|
||||
version:
|
||||
description: 'Version to deploy (short SHA or "latest")'
|
||||
required: true
|
||||
default: 'tinqs/main'
|
||||
default: 'latest'
|
||||
restart:
|
||||
description: 'Restart gitea service after deploy'
|
||||
type: boolean
|
||||
@@ -17,28 +17,25 @@ jobs:
|
||||
deploy:
|
||||
runs-on: host
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch }}
|
||||
- name: Download tinqs-git from S3
|
||||
run: |
|
||||
VERSION="${{ github.event.inputs.version }}"
|
||||
S3_PATH="s3://tinqs-builds/tinqs-git/$VERSION/tinqs-git"
|
||||
|
||||
- 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
|
||||
echo "Downloading tinqs-git ($VERSION)..."
|
||||
aws s3 cp "$S3_PATH" /tmp/tinqs-git
|
||||
chmod +x /tmp/tinqs-git
|
||||
ls -lh /tmp/tinqs-git
|
||||
echo "OK downloaded tinqs-git ($VERSION)"
|
||||
|
||||
- name: Deploy to git.arikigame.com
|
||||
env:
|
||||
RESTART: ${{ github.event.inputs.restart }}
|
||||
VERSION: ${{ github.event.inputs.version }}
|
||||
run: |
|
||||
set -e
|
||||
echo "Deploying tinqs-git ($VERSION)..."
|
||||
|
||||
echo "Backing up current binary..."
|
||||
sudo cp /usr/local/bin/gitea /usr/local/bin/gitea.backup.$(date +%Y%m%d-%H%M%S) || true
|
||||
|
||||
@@ -46,7 +43,7 @@ jobs:
|
||||
sudo systemctl stop gitea || true
|
||||
|
||||
echo "Installing tinqs-git..."
|
||||
sudo cp gitea /usr/local/bin/gitea
|
||||
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
|
||||
|
||||
@@ -58,4 +55,4 @@ jobs:
|
||||
else
|
||||
echo "Restart skipped. Start manually: sudo systemctl start gitea"
|
||||
fi
|
||||
echo "Deploy complete."
|
||||
echo "Deploy complete: tinqs-git ($VERSION)"
|
||||
|
||||
Reference in New Issue
Block a user