Files
tern-web/.gitea/workflows/release.yml
T
Mateusz PstruchaandClaude Opus 5.5 f2a9e1762f
CI / build (push) Successful in 12s
Deploy tern-web on its own, calling the API on its own origin
The webapp now deploys from its own release as a static-server Swarm
stack (deploy/static.yml, tern.mtps.pl on 11902) instead of driving the
server's deployment. It's built with VITE_TERN_API — the
TERN_API_URL repository variable, defaulting to
https://tern-api.mtps.pl — and sends REST calls and the live-update
socket there. Empty (development), it stays same-origin behind Vite's
proxy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:44:22 +02:00

76 lines
2.0 KiB
YAML

name: Release
on:
push:
tags: ['v*']
jobs:
release:
runs-on: rocky-10
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run check
# The API is its own origin when deployed. Overridable with the
# TERN_API_URL repository variable.
- name: Build
run: npm run build
env:
VITE_TERN_API: ${{ vars.TERN_API_URL || 'https://tern-api.mtps.pl' }}
- name: Create release archive
run: |
VERSION="${GITHUB_REF_NAME#v}"
# Archive the *contents* of dist/ rather than dist/ itself, so it
# untars straight into an nginx web root.
tar -czf "tern-web-${VERSION}.tgz" -C dist .
sha256sum "tern-web-${VERSION}.tgz" > "tern-web-${VERSION}.tgz.sha256"
- name: Create release
uses: akkuman/gitea-release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
server_url: ${{ gitea.server_url }}
tag_name: ${{ gitea.ref_name }}
name: ${{ gitea.ref_name }}
files: |-
tern-web-*.tgz
tern-web-*.tgz.sha256
# Deploys the release just published to tern.mtps.pl (deploy/static on
# the swarm; see deploy/static.yml).
deploy:
needs: release
runs-on: rocky-10
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Derive version
id: version
env:
TAG: ${{ gitea.ref_name }}
run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
- name: Deploy
uses: https://git.app.ygg/ygg/actions/deploy@v2
with:
type: static
dist-path: deploy/static.yml
extra-vars: |
version=${{ steps.version.outputs.version }}
ssh-key: ${{ secrets.DEPLOY_SSH_KEY }}
known-hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }}