Skip to content

Commit 7beae98

Browse files
committed
ci: Enhance RC release workflow to handle skipped jobs
1 parent 2bd0f47 commit 7beae98

1 file changed

Lines changed: 28 additions & 16 deletions

File tree

.github/workflows/rc-release.yml

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ jobs:
410410
name: Validate Jira Fix Version
411411
runs-on: ubuntu-latest
412412
needs: [validate-release, pre-publish-gate]
413-
if: needs.validate-release.outputs.is_valid == 'true' && needs.pre-publish-gate.outputs.passed == 'true'
413+
if: always() && needs.pre-publish-gate.result == 'success' && needs.pre-publish-gate.outputs.passed == 'true'
414414
steps:
415415
- name: Verify Jira fix version exists
416416
env:
@@ -448,7 +448,7 @@ jobs:
448448
name: Publish RC to npm
449449
runs-on: ubuntu-latest
450450
needs: [validate-release, prepare-branch, pre-publish-gate, validate-jira]
451-
if: needs.validate-release.outputs.is_valid == 'true' && needs.pre-publish-gate.outputs.passed == 'true'
451+
if: always() && needs.pre-publish-gate.result == 'success' && needs.pre-publish-gate.outputs.passed == 'true' && (needs.validate-jira.result == 'success' || needs.validate-jira.result == 'skipped')
452452
steps:
453453
- name: Checkout repository
454454
uses: actions/checkout@v5
@@ -642,12 +642,14 @@ jobs:
642642
PRERELEASE_RESULT: ${{ needs.create-prerelease.result }}
643643
run: |
644644
set -euo pipefail
645+
ok() { [[ "$1" == "success" || "$1" == "skipped" ]]; }
646+
645647
if [[ "$VALIDATE_RESULT" == "success" \
646648
&& "$PREPARE_RESULT" == "success" \
647-
&& "$GATE_RESULT" == "success" \
648-
&& "$JIRA_RESULT" == "success" \
649-
&& "$PUBLISH_RESULT" == "success" \
650-
&& "$PRERELEASE_RESULT" == "success" ]]; then
649+
&& "$GATE_RESULT" == "success" ]] \
650+
&& ok "$JIRA_RESULT" \
651+
&& ok "$PUBLISH_RESULT" \
652+
&& ok "$PRERELEASE_RESULT"; then
651653
echo "success=true" >> "$GITHUB_OUTPUT"
652654
echo "failed_stage=" >> "$GITHUB_OUTPUT"
653655
exit 0
@@ -659,9 +661,9 @@ jobs:
659661
echo "failed_stage=prepare-branch" >> "$GITHUB_OUTPUT"
660662
elif [[ "$GATE_RESULT" != "success" ]]; then
661663
echo "failed_stage=pre-publish-gate" >> "$GITHUB_OUTPUT"
662-
elif [[ "$JIRA_RESULT" != "success" ]]; then
664+
elif ! ok "$JIRA_RESULT"; then
663665
echo "failed_stage=validate-jira" >> "$GITHUB_OUTPUT"
664-
elif [[ "$PUBLISH_RESULT" != "success" ]]; then
666+
elif ! ok "$PUBLISH_RESULT"; then
665667
echo "failed_stage=publish-rc" >> "$GITHUB_OUTPUT"
666668
else
667669
echo "failed_stage=create-prerelease" >> "$GITHUB_OUTPUT"
@@ -781,23 +783,23 @@ jobs:
781783
fi
782784
783785
- name: Send Slack notification (Success)
784-
if: steps.status.outputs.success == 'true' && needs.validate-release.outputs.is_dry_run != 'true'
786+
if: steps.status.outputs.success == 'true'
785787
uses: slackapi/slack-github-action@v1
786788
with:
787789
payload: |
788790
{
789-
"text": "<!here>\n:react::react::react::react::react::react::react::react::react::react::react::react:\n\n*React Native Release Candidate:*\nreact-native-appsflyer: ${{ needs.validate-release.outputs.version }} is ready for QA testing.\n\n*Pre-publish checks:*\n${{ steps.legs.outputs.ci_icon }} Lint, Test & Build: ${{ steps.legs.outputs.ci_result }}\n${{ steps.legs.outputs.ios_icon }} RC-E2E iOS: ${{ steps.legs.outputs.e2e_ios_result }}\n${{ steps.legs.outputs.android_icon }} RC-E2E Android: ${{ steps.legs.outputs.e2e_android_result }}\n\n*Testing Instructions:*\n```\nnpm install react-native-appsflyer@${{ needs.validate-release.outputs.version }} --save\n```\n\n*Sources:*\n:github: https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}\n:github: Release: https://github.com/${{ github.repository }}/releases/tag/${{ needs.validate-release.outputs.version }}\n:github: Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n\n*Changes and fixes:*\n${{ steps.extract-info.outputs.changelog }}\n\n*Linked tickets and issues:*\n${{ steps.jira-tickets.outputs.tickets }}\n\n*Native SDKs:*\n:android: ${{ steps.extract-info.outputs.android_sdk }}\n:apple: ${{ steps.extract-info.outputs.ios_sdk }}\n\n:react::react::react::react::react::react::react::react::react::react::react::react:"
791+
"text": "<!here>\n:react::react::react::react::react::react::react::react::react::react::react::react:\n\n${{ needs.validate-release.outputs.is_dry_run == 'true' && ':test_tube: *[DRY RUN]* ' || '' }}*React Native Release Candidate:*\nreact-native-appsflyer: ${{ needs.validate-release.outputs.version }} ${{ needs.validate-release.outputs.is_dry_run == 'true' && 'pipeline completed (not published to npm)' || 'is ready for QA testing' }}.\n\n*Pre-publish checks:*\n${{ steps.legs.outputs.ci_icon }} Lint, Test & Build: ${{ steps.legs.outputs.ci_result }}\n${{ steps.legs.outputs.ios_icon }} RC-E2E iOS: ${{ steps.legs.outputs.e2e_ios_result }}\n${{ steps.legs.outputs.android_icon }} RC-E2E Android: ${{ steps.legs.outputs.e2e_android_result }}\n${{ needs.validate-release.outputs.is_dry_run != 'true' && format('\n*Testing Instructions:*\n```\nnpm install react-native-appsflyer@{0} --save\n```', needs.validate-release.outputs.version) || '' }}\n\n*Sources:*\n:github: https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}\n:github: Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n${{ needs.validate-release.outputs.is_dry_run != 'true' && format(':github: Release: https://github.com/{0}/releases/tag/{1}', github.repository, needs.validate-release.outputs.version) || '' }}\n\n*Changes and fixes:*\n${{ steps.extract-info.outputs.changelog }}\n\n*Linked tickets and issues:*\n${{ steps.jira-tickets.outputs.tickets }}\n\n*Native SDKs:*\n:android: ${{ steps.extract-info.outputs.android_sdk }}\n:apple: ${{ steps.extract-info.outputs.ios_sdk }}\n\n:react::react::react::react::react::react::react::react::react::react::react::react:"
790792
}
791793
env:
792794
SLACK_WEBHOOK_URL: ${{ secrets.CI_SLACK_HOOK }}
793795

794796
- name: Send failure notification
795-
if: steps.status.outputs.success == 'false' && needs.validate-release.outputs.is_dry_run != 'true'
797+
if: steps.status.outputs.success == 'false'
796798
uses: slackapi/slack-github-action@v1
797799
with:
798800
payload: |
799801
{
800-
"text": "<!here>\n:warning: *React Native RC failed at `${{ steps.status.outputs.failed_stage }}`*\n\nVersion: ${{ needs.validate-release.outputs.version }}\nBranch: ${{ github.ref_name }}\nRun: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n\n*Pre-publish checks:*\n${{ steps.legs.outputs.ci_icon }} Lint, Test & Build: ${{ steps.legs.outputs.ci_result }}\n${{ steps.legs.outputs.ios_icon }} RC-E2E iOS: ${{ steps.legs.outputs.e2e_ios_result }}\n${{ steps.legs.outputs.android_icon }} RC-E2E Android: ${{ steps.legs.outputs.e2e_android_result }}\n\n*Downstream stages:*\n- prepare-branch: ${{ needs.prepare-branch.result }}\n- pre-publish-gate: ${{ needs.pre-publish-gate.result }}\n- validate-jira: ${{ needs.validate-jira.result }}\n- publish-rc: ${{ needs.publish-rc.result }}\n- create-prerelease: ${{ needs.create-prerelease.result }}"
802+
"text": "<!here>\n:warning: *${{ needs.validate-release.outputs.is_dry_run == 'true' && '[DRY RUN] ' || '' }}React Native RC failed at `${{ steps.status.outputs.failed_stage }}`*\n\nVersion: ${{ needs.validate-release.outputs.version }}\nBranch: ${{ github.ref_name }}\nRun: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\n\n*Pre-publish checks:*\n${{ steps.legs.outputs.ci_icon }} Lint, Test & Build: ${{ steps.legs.outputs.ci_result }}\n${{ steps.legs.outputs.ios_icon }} RC-E2E iOS: ${{ steps.legs.outputs.e2e_ios_result }}\n${{ steps.legs.outputs.android_icon }} RC-E2E Android: ${{ steps.legs.outputs.e2e_android_result }}\n\n*Downstream stages:*\n- prepare-branch: ${{ needs.prepare-branch.result }}\n- pre-publish-gate: ${{ needs.pre-publish-gate.result }}\n- validate-jira: ${{ needs.validate-jira.result }}\n- publish-rc: ${{ needs.publish-rc.result }}\n- create-prerelease: ${{ needs.create-prerelease.result }}"
801803
}
802804
env:
803805
SLACK_WEBHOOK_URL: ${{ secrets.CI_SLACK_HOOK }}
@@ -832,10 +834,20 @@ jobs:
832834
echo "Pre-release tag + PR: ${{ needs.create-prerelease.result }}"
833835
echo "========================================="
834836
835-
if [[ "${{ needs.validate-release.result }}" == "success" ]] && \
836-
[[ "${{ needs.pre-publish-gate.result }}" == "success" ]] && \
837-
[[ "${{ needs.publish-rc.result }}" == "success" ]] && \
838-
[[ "${{ needs.create-prerelease.result }}" == "success" ]]; then
837+
ok() { [[ "$1" == "success" || "$1" == "skipped" ]]; }
838+
839+
FAIL=0
840+
# validate-release and pre-publish-gate must succeed (never legitimately skipped)
841+
[[ "${{ needs.validate-release.result }}" == "success" ]] || FAIL=1
842+
[[ "${{ needs.pre-publish-gate.result }}" == "success" ]] || FAIL=1
843+
# downstream jobs may be skipped (dry-run, skip_e2e, etc.)
844+
ok "${{ needs.run-ci.result }}" || FAIL=1
845+
ok "${{ needs.prepare-branch.result }}" || FAIL=1
846+
ok "${{ needs.validate-jira.result }}" || FAIL=1
847+
ok "${{ needs.publish-rc.result }}" || FAIL=1
848+
ok "${{ needs.create-prerelease.result }}" || FAIL=1
849+
850+
if [[ "$FAIL" == "0" ]]; then
839851
echo "RC Release Process Completed Successfully"
840852
else
841853
echo "RC Release Process Failed"

0 commit comments

Comments
 (0)