diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 65a6e11..0c84466 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -257,21 +257,29 @@ jobs: runs-on: ubuntu-latest needs: [test, security-tests] if: github.event_name == 'push' && github.ref == 'refs/heads/main' - container: - image: quay.io/podman/stable:latest steps: - name: Checkout run: | - dnf install -yq git >/dev/null 2>&1 git clone --depth 1 --branch "${GITHUB_REF_NAME}" \ "https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" . - name: Build image run: | + # Use docker or podman, whichever is available + if command -v docker >/dev/null 2>&1; then + BUILD_CMD="docker" + elif command -v podman >/dev/null 2>&1; then + BUILD_CMD="podman" + else + echo "::error::Neither docker nor podman found" + exit 1 + fi + echo "Using: $BUILD_CMD" + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) - podman build -t flaskpaste:latest -t flaskpaste:sha-${SHORT_SHA} . - podman images | grep flaskpaste + $BUILD_CMD build -t flaskpaste:latest -t flaskpaste:sha-${SHORT_SHA} . + $BUILD_CMD images | grep flaskpaste - name: Push to Harbor env: @@ -285,13 +293,20 @@ jobs: exit 0 fi + # Use docker or podman + if command -v docker >/dev/null 2>&1; then + BUILD_CMD="docker" + else + BUILD_CMD="podman" + fi + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) - podman login "${HARBOR_REGISTRY}" \ - -u "$HARBOR_USER" -p "$HARBOR_PASS" --tls-verify=false + $BUILD_CMD login "${HARBOR_REGISTRY}" \ + -u "$HARBOR_USER" -p "$HARBOR_PASS" for tag in latest sha-${SHORT_SHA}; do - podman tag flaskpaste:latest "${HARBOR_REGISTRY}/library/flaskpaste:${tag}" - podman push "${HARBOR_REGISTRY}/library/flaskpaste:${tag}" --tls-verify=false + $BUILD_CMD tag flaskpaste:latest "${HARBOR_REGISTRY}/library/flaskpaste:${tag}" + $BUILD_CMD push "${HARBOR_REGISTRY}/library/flaskpaste:${tag}" echo "Pushed: ${HARBOR_REGISTRY}/library/flaskpaste:${tag}" done