Publish agent-mode pushes as :agent-mode (and :sha-<commit>) so the experimental fork is available from the registry without overwriting the Classic :latest image. Co-authored-by: Cursor <cursoragent@cursor.com>
96 lines
2.8 KiB
YAML
96 lines
2.8 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 }}
|
|
|
|
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
|
|
```
|