APP_BASE_URL default (config, .env.example, both compose files) is now https://conchecker.scoutitsystems.com with no port, so review-required and final-report email links use the public site. CI bakes the short commit SHA into the image as APP_BUILD via a Docker build-arg; /health returns version+build and the site header shows the build so it's easy to confirm which image is deployed. Local runs default to 'dev'.
98 lines
2.9 KiB
YAML
98 lines
2.9 KiB
YAML
name: Docker Release
|
|
|
|
on:
|
|
push:
|
|
branches: [main, agent-mode]
|
|
tags: ["v*"]
|
|
|
|
env:
|
|
REGISTRY: gitea.scoutitsystems.com
|
|
# Gitea container registry: {registry}/{owner}/{image}
|
|
IMAGE: gitea.scoutitsystems.com/woogi/conflict-checker
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Image tags
|
|
id: meta
|
|
run: |
|
|
short_sha="${GITHUB_SHA:0:7}"
|
|
echo "short_sha=${short_sha}" >> "$GITHUB_OUTPUT"
|
|
|
|
{
|
|
echo "tags<<EOF"
|
|
echo "${IMAGE}:sha-${short_sha}"
|
|
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
|
|
ref_name="${GITHUB_REF_NAME}"
|
|
echo "${IMAGE}:${ref_name}"
|
|
echo "${IMAGE}:${ref_name#v}"
|
|
elif [ "${GITHUB_REF_NAME}" = "main" ]; then
|
|
# Only the stable Classic line publishes :latest.
|
|
echo "${IMAGE}:latest"
|
|
else
|
|
# Feature branches (e.g. agent-mode) publish under a branch tag
|
|
# so they never overwrite the default :latest image.
|
|
branch_tag="${GITHUB_REF_NAME//\//-}"
|
|
echo "${IMAGE}:${branch_tag}"
|
|
fi
|
|
echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
env:
|
|
IMAGE: ${{ env.IMAGE }}
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
GITHUB_REF_TYPE: ${{ github.ref_type }}
|
|
GITHUB_REF_NAME: ${{ github.ref_name }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
build-args: |
|
|
APP_BUILD=sha-${{ steps.meta.outputs.short_sha }}
|
|
|
|
release:
|
|
needs: build-and-push
|
|
if: github.ref_type == 'tag'
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Publish Gitea release
|
|
uses: https://gitea.com/actions/gitea-release-action@v1
|
|
env:
|
|
NODE_OPTIONS: "--experimental-fetch"
|
|
with:
|
|
token: ${{ secrets.REGISTRY_TOKEN }}
|
|
tag_name: ${{ github.ref_name }}
|
|
name: Conflict Checker ${{ github.ref_name }}
|
|
body: |
|
|
## Docker
|
|
|
|
```bash
|
|
docker login gitea.scoutitsystems.com
|
|
docker pull gitea.scoutitsystems.com/woogi/conflict-checker:${{ github.ref_name }}
|
|
```
|
|
|
|
Deploy on a host (with `docker-compose.prod.yml` and `backend/.env`):
|
|
|
|
```bash
|
|
IMAGE_TAG=${{ github.ref_name }} docker compose -f docker-compose.prod.yml up -d
|
|
```
|