Use built-in Gitea token for registry deploys
Test, build, and deploy ComfyUI Jobs / test-build (push) Successful in 11m21s
Test, build, and deploy ComfyUI Jobs / deploy (push) Failing after 8s

This commit is contained in:
2026-10-02 21:40:38 +00:00
parent 4a041ddbc9
commit b00985aac2
2 changed files with 13 additions and 9 deletions
+12 -8
View File
@@ -25,25 +25,29 @@ jobs:
if: ${{ gitea.event_name == 'push' }}
needs: test-build
runs-on: docker
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
github-server-url: https://git.dumas.ddns.net
- name: Load deployment SSH key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
- name: Deploy selected environment
shell: bash
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
REGISTRY_USERNAME: ${{ gitea.actor }}
REGISTRY_PASSWORD: ${{ secrets.GITEA_TOKEN }}
GITEA_REF: ${{ gitea.ref }}
GITEA_SHA: ${{ gitea.sha }}
run: |
set -Eeuo pipefail
mkdir -p ~/.ssh
printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts
case "$GITEA_REF" in
refs/heads/develop) TARGET_DIR=/mnt/appdata/dev/ComfyUiPortal; COMPOSE_FILE=docker-compose.dev.yml; PROJECT=comfyuiportal-next-dev; PORT=7002; HEALTH_URL=http://192.168.1.15:7002; BRANCH=develop ;;
@@ -55,13 +59,13 @@ jobs:
IMAGE_REF=git.dumas.ddns.net/chris.dumas/comfyui-portal-next:sha-${GITEA_SHA}
if [ -z "$REGISTRY_USERNAME" ] || [ -z "$REGISTRY_PASSWORD" ]; then
echo 'REGISTRY_USERNAME and REGISTRY_PASSWORD are required Gitea secrets'
echo 'Gitea Actions token is unavailable for registry authentication'
exit 1
fi
printf '%s' "$REGISTRY_PASSWORD" | ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes "${DEPLOY_USER}@${DEPLOY_HOST}" "docker login git.dumas.ddns.net --username '$REGISTRY_USERNAME' --password-stdin"
printf '%s' "$REGISTRY_PASSWORD" | ssh -o StrictHostKeyChecking=yes "${DEPLOY_USER}@${DEPLOY_HOST}" "docker login git.dumas.ddns.net --username '$REGISTRY_USERNAME' --password-stdin"
ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes "${DEPLOY_USER}@${DEPLOY_HOST}" "
ssh -o StrictHostKeyChecking=yes "${DEPLOY_USER}@${DEPLOY_HOST}" "
set -Eeuo pipefail
trap 'docker logout git.dumas.ddns.net >/dev/null 2>&1 || true' EXIT
mkdir -p '$TARGET_DIR'
+1 -1
View File
@@ -15,4 +15,4 @@ The first run seeds `data/users.json` from `ADMIN_USERNAME` and `ADMIN_PASSWORD`
Gitea Actions deploys `develop`, `qa`, and `main` to the existing ComfyUiPortal target directories and preserves the existing 7002/6002/5002 port contract. On first startup of a fresh data directory, provide `ADMIN_USERNAME` and `ADMIN_PASSWORD` in the deployment host environment. Existing target data is retained during repository cutover.
The deployment workflow builds an immutable image tagged with the source commit SHA and publishes it to the Gitea container registry. If that SHA-tagged image already exists, the workflow reuses it instead of rebuilding. Configure `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` as Gitea Actions secrets. Compose receives the exact image reference through `IMAGE_REF`, so the same artifact can be redeployed or promoted without rebuilding.
The deployment workflow builds an immutable image tagged with the source commit SHA and publishes it to the Gitea container registry. If that SHA-tagged image already exists, the workflow reuses it instead of rebuilding. The workflow uses Gitea's built-in `GITEA_TOKEN` with package-write permission. Compose receives the exact image reference through `IMAGE_REF`, so the same artifact can be redeployed or promoted without rebuilding.