Files
tern-server/.gitea/workflows/release.yml
T
Mateusz PstruchaandClaude Opus 5.5 0f497d88de
CI / test (push) Successful in 3m56s
Deploy tern-server on its own; accept hex keys; fix cross-origin auth
The integrated stack is gone: deploy/compose.yml is just the server and
its Postgres, published on 11901 behind the existing nginx as
tern-api.mtps.pl, and this repo's release deploys it after pushing the
image. The webapp deploys separately from tern-web.

CREDENTIAL_KEY may now be 64 hex digits as well as base64, and a wrong
length says how to generate a right one. The database password reaches
the server as PGPASSWORD rather than inside DATABASE_URL, so it needs
no URL-escaping.

CORS now names Authorization and Content-Type instead of `*`: browsers
don't let the wildcard cover Authorization, so every signed-in request
from the webapp's own origin would have been refused. A route test
checks the preflight.

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

53 lines
1.6 KiB
YAML

name: Release
on:
push:
tags: ['v*']
jobs:
image:
runs-on: rocky-10
outputs:
version: ${{ steps.image.outputs.version }}
digest: ${{ steps.image.outputs.digest }}
steps:
- name: Check out source
uses: actions/checkout@v4
# The shared ygg action builds ./Dockerfile as
# git.app.ygg/mtps/tern-server, tagged with the version (v stripped)
# and latest, with OCI source/revision/created/version labels. It logs
# in through a temporary DOCKER_CONFIG, so the token never lands in the
# runner's ~/.docker, and builds with --progress=plain.
- name: Build and push image
id: image
uses: https://git.app.ygg/ygg/actions/push-image@v2
with:
registry-token: ${{ secrets.REGISTRY_TOKEN }}
- name: Show image
env:
TAGS: ${{ steps.image.outputs.tags }}
DIGEST: ${{ steps.image.outputs.digest }}
run: |
printf 'tags: %s\ndigest: %s\n' "$TAGS" "$DIGEST"
# Deploys the image just pushed to tern-api.mtps.pl (deploy/compose on
# the app host; see deploy/README.md).
deploy:
needs: image
runs-on: rocky-10
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Deploy
uses: https://git.app.ygg/ygg/actions/deploy@v2
with:
type: compose
dist-path: deploy/compose.yml
extra-vars: |
version=${{ needs.image.outputs.version }}
ssh-key: ${{ secrets.DEPLOY_SSH_KEY }}
known-hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }}