From f4097b0b2fa993bf8fba7faaabcbc081d2d51ed1 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Jul 2026 01:26:04 -0400 Subject: [PATCH] fix deploy --- .gitea/workflows/build-and-deploy.yml | 53 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml index 731c2ad..e80d16d 100644 --- a/.gitea/workflows/build-and-deploy.yml +++ b/.gitea/workflows/build-and-deploy.yml @@ -23,22 +23,27 @@ jobs: build-image: name: Build & Push Docker Image runs-on: ubuntu-latest + container: + image: docker:27-git + defaults: + run: + shell: sh outputs: image_repository: ${{ steps.image-meta.outputs.repository }} docker_image: ${{ steps.image-meta.outputs.full }} steps: - name: Checkout repository - shell: bash + shell: sh env: GITEA_SERVER_URL: ${{ gitea.server_url }} GITEA_REPOSITORY: ${{ gitea.repository }} GITEA_SHA: ${{ gitea.sha }} CHECKOUT_TOKEN: ${{ gitea.token }} run: | - set -euo pipefail + set -eu if ! command -v git >/dev/null 2>&1; then - apt-get update -qq - apt-get install -y -qq ca-certificates git + echo "::error::git is not available in the job image. Use a runner image that includes git, such as docker:27-git." + exit 1 fi WORKSPACE="${GITHUB_WORKSPACE:-$PWD}" @@ -70,8 +75,8 @@ jobs: - name: Ensure Docker CLI is available run: | if ! command -v docker >/dev/null 2>&1; then - apt-get update -qq - apt-get install -y -qq docker.io + echo "::error::docker is not available in the job image. Use a runner image that includes Docker CLI and Buildx." + exit 1 fi docker --version docker info >/dev/null @@ -116,7 +121,7 @@ jobs: fi - name: Validate public URLs - shell: bash + shell: sh env: NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} NEXT_PUBLIC_HOMEPAGE_URL: ${{ secrets.NEXT_PUBLIC_HOMEPAGE_URL }} @@ -125,27 +130,28 @@ jobs: NEXT_PUBLIC_ADMIN_URL: ${{ secrets.NEXT_PUBLIC_ADMIN_URL }} SITE_ORIGIN: ${{ secrets.SITE_ORIGIN }} run: | - for variable in \ - NEXT_PUBLIC_API_URL \ - NEXT_PUBLIC_HOMEPAGE_URL \ - NEXT_PUBLIC_STOREFRONT_URL \ - NEXT_PUBLIC_DASHBOARD_URL \ - NEXT_PUBLIC_ADMIN_URL \ - SITE_ORIGIN - do - value="${!variable}" + validate_url() { + name="$1" + value="$2" if [ -z "$value" ]; then - echo "::error::$variable is missing — add it to Gitea Actions secrets" + echo "::error::$name is missing — add it to Gitea Actions secrets" exit 1 fi case "$value" in http://*|https://*) ;; *) - echo "::error::$variable must be an absolute URL (got: $value)" + echo "::error::$name must be an absolute URL (got: $value)" exit 1 ;; esac - done + } + + validate_url NEXT_PUBLIC_API_URL "$NEXT_PUBLIC_API_URL" + validate_url NEXT_PUBLIC_HOMEPAGE_URL "$NEXT_PUBLIC_HOMEPAGE_URL" + validate_url NEXT_PUBLIC_STOREFRONT_URL "$NEXT_PUBLIC_STOREFRONT_URL" + validate_url NEXT_PUBLIC_DASHBOARD_URL "$NEXT_PUBLIC_DASHBOARD_URL" + validate_url NEXT_PUBLIC_ADMIN_URL "$NEXT_PUBLIC_ADMIN_URL" + validate_url SITE_ORIGIN "$SITE_ORIGIN" - name: Log in to Gitea Container Registry if: steps.registry-check.outputs.available == 'true' @@ -210,8 +216,8 @@ jobs: run: | set -euo pipefail if ! command -v git >/dev/null 2>&1; then - apt-get update -qq - apt-get install -y -qq ca-certificates git + echo "::error::git must be available in the runner image; this workflow cannot install git while runner DNS is unavailable." + exit 1 fi WORKSPACE="${GITHUB_WORKSPACE:-$PWD}" @@ -255,7 +261,10 @@ jobs: - name: Install SSH client if: steps.check-creds.outputs.skip == 'false' run: | - apt-get update -qq && apt-get install -y -qq openssh-client + if ! command -v ssh >/dev/null 2>&1 || ! command -v scp >/dev/null 2>&1; then + echo "::error::ssh and scp must be available in the runner image; this workflow cannot install openssh-client while runner DNS is unavailable." + exit 1 + fi - name: Set up SSH key if: steps.check-creds.outputs.skip == 'false'