From ccf833d6987da9909c839379314d261b2d237c93 Mon Sep 17 00:00:00 2001 From: moilanik Date: Sun, 14 Jun 2026 13:11:50 +0300 Subject: [PATCH] =?UTF-8?q?=C3=B6o=C3=A4mj?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build_publish-artifact.yml | 32 +++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/build_publish-artifact.yml b/.gitea/workflows/build_publish-artifact.yml index 5f646b1..44e06df 100644 --- a/.gitea/workflows/build_publish-artifact.yml +++ b/.gitea/workflows/build_publish-artifact.yml @@ -51,17 +51,25 @@ jobs: TAG=$(echo "$TAGS_JSON" | jq -r 'if type == "array" then .[] | select(.commit.sha == "'"$GITHUB_SHA"'") | .name else empty end' | head -1) if [ -n "$TAG" ]; then echo "artifact_exists=true" >> "$GITHUB_OUTPUT" - echo "Commit already tagged as $TAG, skipping build" + echo "artifact_tag=$TAG" >> "$GITHUB_OUTPUT" + echo "Build skipped: commit already tagged as $TAG" else echo "artifact_exists=false" >> "$GITHUB_OUTPUT" + echo "Build required: no tag for this commit" fi - name: Report check status if: always() run: | - VERSION="${{ needs.check.outputs.version }}" + VERSION="${{ steps.check.outputs.version }}" + ARTIFACT_EXISTS="${{ steps.check.outputs.artifact_exists }}" + ARTIFACT_TAG="${{ steps.check.outputs.artifact_tag }}" if [ "${{ steps.check.outcome }}" = "success" ]; then - bash scripts/report-status.sh success "Check version $VERSION" ci-check + if [ "${ARTIFACT_EXISTS}" = "true" ]; then + bash scripts/report-status.sh success "Skip build: version $VERSION exists as $ARTIFACT_TAG" ci-check + else + bash scripts/report-status.sh success "Build version $VERSION required" ci-check + fi else bash scripts/report-status.sh failure "Check version $VERSION FAILED" ci-check exit 1 @@ -79,6 +87,9 @@ jobs: build: needs: [check, quality-gate] + if: | + needs.check.outputs.artifact_exists == 'false' && + needs.quality-gate.result == 'success' runs-on: ubuntu-latest services: docker: @@ -106,11 +117,12 @@ jobs: - name: Report docker build status if: always() run: | + VERSION="${{ needs.check.outputs.version }}" BUILD_EXIT="${{ steps.build.outputs.exit-code }}" if [ "${BUILD_EXIT}" = "0" ]; then - bash scripts/report-status.sh success "Docker build OK" ci-docker-build + bash scripts/report-status.sh success "Docker build $VERSION OK" ci-docker-build else - bash scripts/report-status.sh failure "Docker build FAILED" ci-docker-build + bash scripts/report-status.sh failure "Docker build $VERSION FAILED" ci-docker-build fi exit ${BUILD_EXIT} @@ -164,11 +176,12 @@ jobs: - name: Report docker push status if: always() run: | + VERSION="${{ needs.check.outputs.version }}" PUSH_EXIT="${{ steps.push.outputs.exit-code }}" if [ "${PUSH_EXIT}" = "0" ]; then - bash scripts/report-status.sh success "Docker push OK" ci-docker-push + bash scripts/report-status.sh success "Docker push $VERSION OK" ci-docker-push else - bash scripts/report-status.sh failure "Docker push FAILED" ci-docker-push + bash scripts/report-status.sh failure "Docker push $VERSION FAILED" ci-docker-push fi exit ${PUSH_EXIT} @@ -210,12 +223,13 @@ jobs: - name: Report docker tag status if: always() run: | + VERSION="${{ needs.check.outputs.version }}" TAG_STATUS="${{ steps.tag.outputs.status }}" TAG_MESSAGE="${{ steps.tag.outputs.message }}" if [ "${TAG_STATUS}" = "success" ]; then - bash scripts/report-status.sh success "${TAG_MESSAGE}" ci-docker-tag + bash scripts/report-status.sh success "Tag $VERSION OK" ci-docker-tag else TAG_EXIT="${{ steps.tag.outputs.exit-code }}" - bash scripts/report-status.sh failure "${TAG_MESSAGE}" ci-docker-tag + bash scripts/report-status.sh failure "Tag $VERSION FAILED" ci-docker-tag exit ${TAG_EXIT} fi