Files
studio/.gitea/workflows/release.yml
T
Workflow config file is invalid. Please check your config file: model.ReadWorkflow: yaml: line 55: could not find expected ':'
ozan a845b744b7 feat: HTML preview via S3 with SWR caching
HTML files now render in an iframe served from S3 (tinqs-git-preview
bucket) instead of Gitea's raw endpoint which forces text/plain.

SWR flow: first request uploads blob to S3 synchronously, subsequent
requests redirect to presigned S3 URL instantly. When the blob SHA
changes (new commit), the stale version is served immediately while
the new version uploads in the background.

Security: iframe uses sandbox="allow-scripts" only (no allow-same-origin).
S3 is a different origin from git.arikigame.com, so even if JS runs in
the iframe it cannot access Gitea session cookies or API tokens.

Config: [html_preview] section in app.ini, disabled by default.
Release pipeline auto-adds config on first deploy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-20 23:33:40 +01:00

75 lines
2.2 KiB
YAML

name: Release tinqs-git
on:
workflow_dispatch:
inputs:
version:
description: 'Version to deploy (short SHA or "latest")'
required: true
default: 'latest'
restart:
description: 'Restart gitea service after deploy'
type: boolean
required: true
default: true
jobs:
deploy:
runs-on: host
steps:
- name: Download tinqs-git from S3
run: |
VERSION="${{ github.event.inputs.version }}"
S3_PATH="s3://tinqs-cli-releases/tinqs-git/$VERSION/tinqs-git"
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
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
# Ensure [html_preview] config exists
if ! sudo grep -q '\[html_preview\]' /etc/gitea/app.ini; then
echo "Adding [html_preview] config..."
sudo tee -a /etc/gitea/app.ini > /dev/null <<'APPINI'
[html_preview]
ENABLED = true
STORAGE_TYPE = minio
MINIO_ENDPOINT = s3.eu-west-1.amazonaws.com
MINIO_BUCKET = tinqs-git-preview
MINIO_LOCATION = eu-west-1
MINIO_USE_SSL = true
SERVE_DIRECT = true
APPINI
fi
if [ "$RESTART" = "true" ]; then
echo "Starting gitea..."
sudo systemctl start gitea
sleep 2
sudo systemctl status gitea --no-pager
else
echo "Restart skipped. Start manually: sudo systemctl start gitea"
fi
echo "Deploy complete: tinqs-git ($VERSION)"