fix(ci): use Gitea commit context for image tags
Runner Canary / runner-canary (push) Successful in 1s

This commit is contained in:
TJWater CI
2026-08-07 17:27:41 +08:00
parent b9fb9d96e1
commit 33c2618671
+4 -4
View File
@@ -52,7 +52,7 @@ jobs:
run: | run: |
set -eu set -eu
docker build --pull=false -f "${{ inputs.dockerfile }}" \ docker build --pull=false -f "${{ inputs.dockerfile }}" \
-t "${{ inputs.image_name }}:sha-${GITEA_SHA}" "${{ inputs.build_context }}" -t "${{ inputs.image_name }}:sha-${{ gitea.sha }}" "${{ inputs.build_context }}"
- name: Login and publish candidate image - name: Login and publish candidate image
env: env:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
@@ -61,7 +61,7 @@ jobs:
set -eu set -eu
registry="$(printf '%s' '${{ inputs.image_name }}' | cut -d/ -f1)" registry="$(printf '%s' '${{ inputs.image_name }}' | cut -d/ -f1)"
printf '%s' "$REGISTRY_PASSWORD" | docker login "$registry" -u "$REGISTRY_USERNAME" --password-stdin printf '%s' "$REGISTRY_PASSWORD" | docker login "$registry" -u "$REGISTRY_USERNAME" --password-stdin
docker push "${{ inputs.image_name }}:sha-${GITEA_SHA}" docker push "${{ inputs.image_name }}:sha-${{ gitea.sha }}"
- name: Candidate pull on Dev - name: Candidate pull on Dev
if: ${{ inputs.deploy_service != '' && inputs.deploy_host != '' }} if: ${{ inputs.deploy_service != '' && inputs.deploy_host != '' }}
env: env:
@@ -74,7 +74,7 @@ jobs:
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H "${{ inputs.deploy_host }}" >> ~/.ssh/known_hosts ssh-keyscan -H "${{ inputs.deploy_host }}" >> ~/.ssh/known_hosts
ssh -i ~/.ssh/id_ed25519 cicd-deploy@"${{ inputs.deploy_host }}" \ ssh -i ~/.ssh/id_ed25519 cicd-deploy@"${{ inputs.deploy_host }}" \
"candidate ${{ inputs.deploy_service }} ${{ inputs.image_name }}:sha-${GITEA_SHA}" "candidate ${{ inputs.deploy_service }} ${{ inputs.image_name }}:sha-${{ gitea.sha }}"
- name: Promote tagged release after candidate check - name: Promote tagged release after candidate check
if: ${{ startsWith(gitea.ref, 'refs/tags/v') && inputs.deploy_service != '' && inputs.deploy_host != '' }} if: ${{ startsWith(gitea.ref, 'refs/tags/v') && inputs.deploy_service != '' && inputs.deploy_host != '' }}
env: env:
@@ -82,4 +82,4 @@ jobs:
run: | run: |
set -eu set -eu
ssh -i ~/.ssh/id_ed25519 cicd-deploy@"${{ inputs.deploy_host }}" \ ssh -i ~/.ssh/id_ed25519 cicd-deploy@"${{ inputs.deploy_host }}" \
"promote ${{ inputs.deploy_service }} ${{ inputs.image_name }}:sha-${GITEA_SHA}" "promote ${{ inputs.deploy_service }} ${{ inputs.image_name }}:sha-${{ gitea.sha }}"