fix: bump min-document from 2.19.0 to 2.19.2 #229
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_tag: | |
| description: 'Existing git tag to publish to npm (e.g. v1.2.3)' | |
| required: false | |
| type: string | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| release-please: | |
| if: github.event_name != 'workflow_dispatch' || github.event.inputs.release_tag == '' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Release PR | |
| uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| token: ${{ secrets.BOT_TOKEN }} | |
| manual-publish: | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag != '' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.release_tag }} | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: npm ci | |
| - run: npm run build-all | |
| - name: Publish to NPM | |
| run: npm publish --provenance --access public | |
| publish-stable: | |
| needs: release-please | |
| # Use tag_name as the definitive indicator - if a tag exists, a release was created | |
| if: needs.release-please.outputs.tag_name != '' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: npm ci | |
| - run: npm run build-all | |
| - name: Publish to NPM | |
| run: npm publish --provenance --access public | |
| publish-edge: | |
| needs: release-please | |
| # Only publish edge if no tag was created (no stable release) | |
| if: needs.release-please.outputs.tag_name == '' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_version: ${{ steps.bump_version.outputs.new_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: npm ci | |
| - name: Get current version from package.json | |
| id: get_version | |
| run: | | |
| current_version=$(node -p "require('./package.json').version") | |
| echo "current_version=${current_version}" >> $GITHUB_OUTPUT | |
| - name: Calculate next version | |
| id: get_next_version | |
| run: | | |
| next_version=$(npx semver ${{ steps.get_version.outputs.current_version }} -i patch) | |
| echo "Next patch version: $next_version" | |
| echo "version=$next_version" >> $GITHUB_OUTPUT | |
| - name: Configure Git | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Checkout or create edge branch | |
| run: | | |
| if git rev-parse --verify origin/${{ steps.get_next_version.outputs.version }}-edge; then | |
| git checkout ${{ steps.get_next_version.outputs.version }}-edge | |
| git merge master -X ours --no-edit | |
| else | |
| git checkout master -b ${{ steps.get_next_version.outputs.version }}-edge | |
| fi | |
| - name: Bump version | |
| id: bump_version | |
| run: | | |
| new_version=$(npm version prerelease --preid=edge) | |
| echo "New edge version: $new_version" | |
| echo "new_version=${new_version}" >> $GITHUB_OUTPUT | |
| - name: Push version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git push origin ${{ steps.get_next_version.outputs.version }}-edge | |
| - run: npm run build-all | |
| - name: Publish to NPM | |
| run: npm publish --tag edge --provenance --access public | |
| notify: | |
| needs: [release-please, publish-stable, publish-edge] | |
| if: always() && (needs.publish-stable.result != null || needs.publish-edge.result != null) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set Notification Messages | |
| id: set-messages | |
| run: | | |
| # Determine version and result based on release type | |
| if [[ -n "${{ needs.release-please.outputs.tag_name }}" ]]; then | |
| VERSION="${{ needs.release-please.outputs.tag_name }}" | |
| PUBLISH_RESULT="${{ needs.publish-stable.result }}" | |
| VER_PARAM="latest" | |
| else | |
| VERSION="${{ needs.publish-edge.outputs.new_version }}" | |
| # Fallback if version output is empty (e.g., if job failed before bump_version) | |
| if [[ -z "$VERSION" ]]; then | |
| VERSION="edge" | |
| fi | |
| PUBLISH_RESULT="${{ needs.publish-edge.result }}" | |
| VER_PARAM="edge" | |
| fi | |
| # Set messages based on publish result | |
| if [[ "$PUBLISH_RESULT" == "success" ]]; then | |
| echo "SLACK_TITLE=Video Player $VERSION Deployed" >> $GITHUB_OUTPUT | |
| echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version $VERSION deployed successfully" >> $GITHUB_OUTPUT | |
| echo "SLACK_FOOTER=Check it out at https://cloudinary.github.io/cloudinary-video-player/?ver=$VER_PARAM&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 $VERSION" >> $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/[email protected] | |
| 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: Determine Package for Cache Purge | |
| id: purge-cache | |
| run: | | |
| if [[ -n "${{ needs.release-please.outputs.tag_name }}" ]]; then | |
| if [[ "${{ needs.publish-stable.result }}" == "success" ]]; then | |
| echo "package=cloudinary-video-player" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| if [[ "${{ needs.publish-edge.result }}" == "success" ]]; then | |
| echo "package=cloudinary-video-player@edge" >> $GITHUB_OUTPUT | |
| fi | |
| fi | |
| - name: Purge jsDelivr Cache | |
| if: steps.purge-cache.outputs.package != '' | |
| uses: ./.github/actions/purge-jsdelivr | |
| with: | |
| package: ${{ steps.purge-cache.outputs.package }} |