chore: normalize registry host for docker image refs
Build Push and Deploy / docker-image (push) Failing after 1m9s
Build Push and Deploy / deploy-fallback-log (push) Successful in 2s

This commit is contained in:
2026-04-24 15:15:03 +08:00
parent 1ed09c9594
commit c2785f0746
+24 -11
View File
@@ -20,17 +20,32 @@ jobs:
with: with:
github-server-url: ${{ github.server_url }} github-server-url: ${{ github.server_url }}
- name: Normalize image metadata
env:
RAW_REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
RAW_REPOSITORY: ${{ github.repository }}
IMAGE_TAG: ${{ github.ref_name }}
run: |
REGISTRY_HOST="${RAW_REGISTRY_HOST#http://}"
REGISTRY_HOST="${REGISTRY_HOST#https://}"
REGISTRY_HOST="${REGISTRY_HOST%/}"
REPOSITORY_PATH="${RAW_REPOSITORY#/}"
IMAGE_NAME="${REGISTRY_HOST}/${REPOSITORY_PATH}"
{
echo "REGISTRY_HOST=${REGISTRY_HOST}"
echo "REPOSITORY_PATH=${REPOSITORY_PATH}"
echo "IMAGE_NAME=${IMAGE_NAME}"
echo "IMAGE_TAG=${IMAGE_TAG}"
echo "IMAGE_REF=${IMAGE_NAME}:${IMAGE_TAG}"
} >> "$GITHUB_ENV"
- name: Login to Gitea Container Registry - name: Login to Gitea Container Registry
uses: docker/login-action@v3 run: |
with: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login "$REGISTRY_HOST" \
registry: ${{ vars.REGISTRY_HOST }} --username "${{ secrets.REGISTRY_USERNAME }}" \
username: ${{ secrets.REGISTRY_USERNAME }} --password-stdin
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and Push Image - name: Build and Push Image
env:
IMAGE_NAME: ${{ vars.REGISTRY_HOST }}/${{ github.repository }}
IMAGE_TAG: ${{ github.ref_name }}
run: | run: |
docker build \ docker build \
-f ./Dockerfile \ -f ./Dockerfile \
@@ -51,13 +66,11 @@ jobs:
- name: Notify Deploy Server - name: Notify Deploy Server
if: success() if: success()
env:
IMAGE: ${{ vars.REGISTRY_HOST }}/${{ github.repository }}:${{ github.ref_name }}
run: | run: |
curl -fsSL -X POST "${{ vars.DEPLOY_WEBHOOK_URL }}" \ curl -fsSL -X POST "${{ vars.DEPLOY_WEBHOOK_URL }}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.DEPLOY_WEBHOOK_TOKEN }}" \ -H "Authorization: Bearer ${{ secrets.DEPLOY_WEBHOOK_TOKEN }}" \
-d "{\"image\":\"${IMAGE}\",\"tag\":\"${{ github.ref_name }}\",\"repo\":\"${{ github.repository }}\"}" -d "{\"image\":\"${IMAGE_REF}\",\"tag\":\"${IMAGE_TAG}\",\"repo\":\"${REPOSITORY_PATH}\"}"
deploy-fallback-log: deploy-fallback-log:
runs-on: ubuntu runs-on: ubuntu