3232 manual-publish :
3333 if : inputs.release_tag != ''
3434 runs-on : ubuntu-latest
35+ outputs :
36+ version : ${{ inputs.release_tag }}
3537 steps :
3638 - uses : actions/checkout@v4
3739 with :
5254 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
5355 run : npm publish --provenance --access public
5456
57+ - name : Purge jsDelivr Cache
58+ if : inputs.dry_run != true
59+ uses : ./.github/actions/purge-jsdelivr
60+ with :
61+ package : cloudinary-video-player
62+
5563 check-release :
5664 if : inputs.release_tag == ''
5765 runs-on : ubuntu-latest
@@ -65,25 +73,39 @@ jobs:
6573
6674 - name : Check if this is a release merge
6775 id : check
76+ env :
77+ GH_TOKEN : ${{ github.token }}
6878 run : |
6979 if [[ "${{ inputs.debug }}" == "true" ]]; then
7080 set -x
7181 fi
7282
73- echo "::group::Checking merge commit"
74- COMMIT_MSG=$(git log -1 --pretty=%s)
75- echo "Commit message: $COMMIT_MSG"
83+ echo "::group::Checking if commit came from release/edge branch"
7684
77- # Check if this commit is from merging a release branch
78- if echo "$COMMIT_MSG" | grep -qE "release/v[0-9]+\.[0-9]+\.[0-9]+"; then
79- echo "::notice::This is a release merge"
85+ # Get the PR associated with this commit
86+ PR_INFO=$(gh api "repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" --jq '.[0] // empty' 2>/dev/null || echo "")
87+
88+ if [[ -z "$PR_INFO" ]]; then
89+ echo "::notice::No PR found for this commit"
90+ echo "is_release=false" >> $GITHUB_OUTPUT
91+ echo "::endgroup::"
92+ exit 0
93+ fi
94+
95+ BRANCH=$(echo "$PR_INFO" | jq -r '.head.ref')
96+ PR_NUMBER=$(echo "$PR_INFO" | jq -r '.number')
97+ echo "PR #$PR_NUMBER merged from branch: $BRANCH"
98+
99+ if [[ "$BRANCH" == "release/edge" ]]; then
100+ echo "::notice::This is a release merge from release/edge"
80101 echo "is_release=true" >> $GITHUB_OUTPUT
81102
82- VERSION=$(echo "$COMMIT_MSG" | grep -oE "v[0-9]+\.[0-9]+\.[0-9]+" | head -1)
103+ # Get version from package.json (already bumped in the PR)
104+ VERSION="v$(jq -r '.version' package.json)"
83105 echo "version=$VERSION" >> $GITHUB_OUTPUT
84106 echo "::notice::Version: $VERSION"
85107 else
86- echo "::notice::This is NOT a release merge"
108+ echo "::notice::This is NOT a release merge (branch: $BRANCH) "
87109 echo "is_release=false" >> $GITHUB_OUTPUT
88110 fi
89111 echo "::endgroup::"
93115 if : needs.check-release.outputs.is_release == 'true'
94116 runs-on : ubuntu-latest
95117 outputs :
96- tag_name : ${{ steps.tag.outputs.tag_name }}
118+ version : ${{ steps.tag.outputs.tag_name }}
97119
98120 steps :
99121 - uses : actions/checkout@v4
@@ -421,8 +443,8 @@ jobs:
421443 echo "- Published to npm with edge tag" >> $GITHUB_STEP_SUMMARY
422444
423445 notify :
424- needs : [check-release, publish-stable, publish-edge ]
425- if : always() && (needs.publish-stable.result == 'success' || needs.publish-edge .result == 'success' || needs.publish-stable.result == 'failure' || needs.publish-edge .result == 'failure')
446+ needs : [publish-stable, manual-publish ]
447+ if : always() && (needs.publish-stable.result == 'success' || needs.manual-publish .result == 'success' || needs.publish-stable.result == 'failure' || needs.manual-publish .result == 'failure')
426448 runs-on : ubuntu-latest
427449
428450 steps :
@@ -431,23 +453,18 @@ jobs:
431453 - name : Set Notification Messages
432454 id : set-messages
433455 run : |
434- if [[ "${{ needs.check-release .outputs.is_release }}" == "true" ]]; then
435- VERSION="${{ needs.publish-stable.outputs.tag_name }}"
436- PUBLISH_RESULT= "${{ needs.publish-stable.result }}"
437- VER_PARAM="latest "
456+ VERSION= "${{ needs.publish-stable .outputs.version }}${{ needs.manual-publish.outputs.version }}"
457+
458+ if [[ "${{ needs.publish-stable.result }}" == "success" || "${{ needs.manual-publish.result }}" == "success" ]]; then
459+ RESULT="success "
438460 else
439- VERSION="${{ needs.publish-edge.outputs.new_version }}"
440- if [[ -z "$VERSION" ]]; then
441- VERSION="edge"
442- fi
443- PUBLISH_RESULT="${{ needs.publish-edge.result }}"
444- VER_PARAM="edge"
461+ RESULT="failure"
445462 fi
446463
447- if [[ "$PUBLISH_RESULT " == "success" ]]; then
464+ if [[ "$RESULT " == "success" ]]; then
448465 echo "SLACK_TITLE=Video Player $VERSION Deployed" >> $GITHUB_OUTPUT
449466 echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version $VERSION deployed successfully" >> $GITHUB_OUTPUT
450- echo "SLACK_FOOTER=Check it out at https://cloudinary.github.io/cloudinary-video-player/?ver=$VER_PARAM &min=true" >> $GITHUB_OUTPUT
467+ echo "SLACK_FOOTER=Check it out at https://cloudinary.github.io/cloudinary-video-player/?ver=latest &min=true" >> $GITHUB_OUTPUT
451468 echo "SLACK_COLOR=good" >> $GITHUB_OUTPUT
452469 else
453470 echo "SLACK_TITLE=Video Player Deployment Failed" >> $GITHUB_OUTPUT
@@ -461,7 +478,7 @@ jobs:
461478 uses : rtCamp/action-slack-notify@v2.2.0
462479 env :
463480 SLACK_WEBHOOK : ${{ vars.FE_DEPLOYMENTS_SLACK_WEBHOOK }}
464- SLACK_CHANNEL : ' rnd-fe-releases '
481+ SLACK_CHANNEL : ' rnd-me-video-team-alerts '
465482 SLACK_COLOR : ${{ steps.set-messages.outputs.SLACK_COLOR }}
466483 SLACK_TITLE : ${{ steps.set-messages.outputs.SLACK_TITLE }}
467484 SLACK_MESSAGE : ${{ steps.set-messages.outputs.SLACK_MESSAGE }}
0 commit comments