feat: add release-as input to force version #214
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🚀 Release | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| workflow_dispatch: | |
| inputs: | |
| release-as: | |
| description: 'Force a specific version (e.g., "3.6.0"). Leave empty for auto-detect.' | |
| required: false | |
| type: string | |
| default: '' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: npm ci | |
| - name: Release PR | |
| uses: google-github-actions/release-please-action@v3 | |
| id: release | |
| with: | |
| token: ${{ secrets.BOT_TOKEN }} | |
| release-type: node | |
| default-branch: master | |
| package-name: cloudinary-video-player | |
| include-v-in-tag: true | |
| release-as: ${{ inputs.release-as || '' }} | |
| publish: | |
| needs: release | |
| if: ${{ needs.release.outputs.release_created == 'true' }} | |
| permissions: | |
| contents: read | |
| id-token: write | |
| uses: ./.github/workflows/npm-publish.yml | |
| notify: | |
| needs: [release, publish] | |
| if: ${{ always() && needs.release.outputs.release_created == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set Notification Messages | |
| id: set-messages | |
| run: | | |
| if [[ "${{ needs.publish.result }}" == "success" ]]; then | |
| echo "SLACK_TITLE=Video Player ${{ needs.release.outputs.tag_name }} Deployed" >> $GITHUB_OUTPUT | |
| echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version ${{ needs.release.outputs.tag_name }} deployed successfully" >> $GITHUB_OUTPUT | |
| echo "SLACK_FOOTER=Check it out at https://cloudinary.github.io/cloudinary-video-player/?ver=latest&min=true" >> $GITHUB_OUTPUT | |
| echo "SLACK_COLOR=good" >> $GITHUB_OUTPUT | |
| else | |
| echo "SLACK_TITLE=Video Player Deployment Failed" >> $GITHUB_OUTPUT | |
| echo "SLACK_MESSAGE=:alert: Failed to deploy cloudinary-video-player version ${{ needs.release.outputs.tag_name }}" >> $GITHUB_OUTPUT | |
| echo "SLACK_FOOTER=See log here https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT | |
| echo "SLACK_COLOR=danger" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| - name: Slack Notification | |
| uses: rtCamp/action-slack-notify@v2.2.0 | |
| env: | |
| SLACK_WEBHOOK: ${{ vars.FE_DEPLOYMENTS_SLACK_WEBHOOK }} | |
| SLACK_CHANNEL: 'rnd-fe-releases' | |
| SLACK_COLOR: ${{ steps.set-messages.outputs.SLACK_COLOR }} | |
| SLACK_TITLE: ${{ steps.set-messages.outputs.SLACK_TITLE }} | |
| SLACK_MESSAGE: ${{ steps.set-messages.outputs.SLACK_MESSAGE }} | |
| SLACK_FOOTER: ${{ steps.set-messages.outputs.SLACK_FOOTER }} | |
| - name: Purge jsDelivr Cache | |
| if: ${{ needs.publish.result == 'success' }} | |
| uses: ./.github/actions/purge-jsdelivr | |
| with: | |
| package: cloudinary-video-player |