@@ -427,22 +427,77 @@ jobs:
427427 exit "$status"
428428
429429 - name : Remove SDK staging tag
430+ id : remove-sdk-staging-tag
430431 if : success() && steps.existing.outputs.stage_pair == 'true'
431432 env :
432433 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
433434 run : |
434435 set -euo pipefail
435436 node "$RELEASE_SCRIPTS_ROOT/assert-publish-identity.mjs" --source-sha "$SOURCE_SHA" --dispatch-sha "${{ github.sha }}" --workflow-sha "${{ github.workflow_sha }}" --tag "$TAG" --evidence-dir "$PACKS_DIR"
436- npm dist-tag rm @bradygaster/squad-sdk "$STAGING_TAG"
437+ if npm dist-tag rm @bradygaster/squad-sdk "$STAGING_TAG"; then
438+ echo "outcome=success" >> "$GITHUB_OUTPUT"
439+ else
440+ status=$?
441+ echo "outcome=failure" >> "$GITHUB_OUTPUT"
442+ echo "exit_code=$status" >> "$GITHUB_OUTPUT"
443+ fi
437444
438445 - name : Remove CLI staging tag
446+ id : remove-cli-staging-tag
439447 if : success() && steps.existing.outputs.stage_pair == 'true'
440448 env :
441449 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
442450 run : |
443451 set -euo pipefail
444452 node "$RELEASE_SCRIPTS_ROOT/assert-publish-identity.mjs" --source-sha "$SOURCE_SHA" --dispatch-sha "${{ github.sha }}" --workflow-sha "${{ github.workflow_sha }}" --tag "$TAG" --evidence-dir "$PACKS_DIR"
445- npm dist-tag rm @bradygaster/squad-cli "$STAGING_TAG"
453+ if npm dist-tag rm @bradygaster/squad-cli "$STAGING_TAG"; then
454+ echo "outcome=success" >> "$GITHUB_OUTPUT"
455+ else
456+ status=$?
457+ echo "outcome=failure" >> "$GITHUB_OUTPUT"
458+ echo "exit_code=$status" >> "$GITHUB_OUTPUT"
459+ fi
460+
461+ - name : Record staging tag cleanup results
462+ if : always() && steps.existing.outputs.stage_pair == 'true'
463+ env :
464+ SDK_CLEANUP_OUTCOME : ${{ steps.remove-sdk-staging-tag.outputs.outcome || 'not-recorded' }}
465+ SDK_CLEANUP_STEP_OUTCOME : ${{ steps.remove-sdk-staging-tag.outcome }}
466+ SDK_CLEANUP_EXIT_CODE : ${{ steps.remove-sdk-staging-tag.outputs.exit_code || '' }}
467+ CLI_CLEANUP_OUTCOME : ${{ steps.remove-cli-staging-tag.outputs.outcome || 'not-recorded' }}
468+ CLI_CLEANUP_STEP_OUTCOME : ${{ steps.remove-cli-staging-tag.outcome }}
469+ CLI_CLEANUP_EXIT_CODE : ${{ steps.remove-cli-staging-tag.outputs.exit_code || '' }}
470+ run : |
471+ set -euo pipefail
472+ node --input-type=module <<'NODE'
473+ import { writeFileSync } from 'node:fs';
474+
475+ const outcomes = {
476+ sdk: {
477+ outcome: process.env.SDK_CLEANUP_OUTCOME,
478+ stepOutcome: process.env.SDK_CLEANUP_STEP_OUTCOME,
479+ exitCode: process.env.SDK_CLEANUP_EXIT_CODE || null,
480+ },
481+ cli: {
482+ outcome: process.env.CLI_CLEANUP_OUTCOME,
483+ stepOutcome: process.env.CLI_CLEANUP_STEP_OUTCOME,
484+ exitCode: process.env.CLI_CLEANUP_EXIT_CODE || null,
485+ },
486+ };
487+ const evidence = {
488+ stagingTag: process.env.STAGING_TAG,
489+ outcomes,
490+ };
491+ writeFileSync(
492+ `${process.env.RECON_DIR}/staging-tag-cleanup.json`,
493+ `${JSON.stringify(evidence, null, 2)}\n`,
494+ );
495+ for (const [pkg, result] of Object.entries(outcomes)) {
496+ if (result.outcome === 'failure') {
497+ console.log(`::warning::Could not remove the ${pkg} staging tag ${process.env.STAGING_TAG}; see cleanup step logs.`);
498+ }
499+ }
500+ NODE
446501
447502 - name : Upload reconciliation evidence
448503 if : always()
@@ -458,7 +513,7 @@ jobs:
458513 publish-draft-release :
459514 name : Publish the existing draft after recovery reconciliation
460515 needs : [prepare, publish]
461- if : inputs.verify_run_id != '' && inputs.publish_draft_release && needs.publish.outputs.outcome == 'COMPLETE'
516+ if : always() && needs.prepare.result == 'success' && inputs.verify_run_id != '' && inputs.publish_draft_release && needs.publish.outputs.outcome == 'COMPLETE'
462517 runs-on : ubuntu-latest
463518 timeout-minutes : 5
464519 permissions :
0 commit comments