Skip to content

Commit

Permalink
Merge branch 'master' into fix-bump-profiles-package
Browse files Browse the repository at this point in the history
  • Loading branch information
tsi authored Jan 29, 2025
2 parents 7669864 + fae9fdb commit 62b2c30
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 1,380 deletions.
7 changes: 0 additions & 7 deletions .github/actions/calculate-edge-version/action.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/actions/calculate-edge-version/index.js

This file was deleted.

51 changes: 0 additions & 51 deletions .github/actions/fetch-latest-release/action.yml

This file was deleted.

60 changes: 0 additions & 60 deletions .github/actions/fetch-latest-release/index.js

This file was deleted.

28 changes: 0 additions & 28 deletions .github/actions/node-setup/action.yml

This file was deleted.

83 changes: 46 additions & 37 deletions .github/workflows/release-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,72 @@ jobs:

- run: npm ci

- name: Get releases
id: fetch-latest-release
uses: ./.github/actions/fetch-latest-release
with:
github_token: ${{ github.token }}

- name: Calculate edge version
id: calculate-edge-version
uses: ./.github/actions/calculate-edge-version
with:
version: ${{ steps.fetch-latest-release.outputs.tag_name }}

- name: Release PR
uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.BOT_TOKEN }}
release-type: node
release-as: ${{ steps.calculate-edge-version.outputs.next-edge }}
prerelease: true
default-branch: master
release-search-depth: 20
changelog-path: CHANGELOG-edge.md

# The logic below handles the npm publication:
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.release_created }}

- 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: |
git fetch origin
if git rev-parse --verify origin/${{ steps.get_next_version.outputs.version }}-edge; then
git checkout ${{ steps.get_next_version.outputs.version }}-edge
else
git checkout -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
if: ${{ steps.release.outputs.release_created }}

- run: npm publish --tag edge
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Set Notification Messages
id: set-messages
if: steps.release.outputs.release_created
run: |
if [[ ${{ job.status }} == "success" ]]; then
echo "SLACK_TITLE=Video Player ${{ steps.release.outputs.tag_name }} Deployed" >> $GITHUB_OUTPUT
echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version ${{ steps.release.outputs.tag_name }} deployed successfully" >> $GITHUB_OUTPUT
echo "SLACK_TITLE=Video Player ${{ steps.bump_version.outputs.new_version }} Deployed" >> $GITHUB_OUTPUT
echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version ${{ steps.bump_version.outputs.new_version }} deployed successfully" >> $GITHUB_OUTPUT
echo "SLACK_FOOTER=Check it out at https://cloudinary.github.io/cloudinary-video-player/?ver=edge&min=true" >> $GITHUB_OUTPUT
else
echo "SLACK_TITLE=Video Player Deployment Failed" >> $GITHUB_OUTPUT
echo "SLACK_MESSAGE=:alert: Failed to deploy cloudinary-video-player version ${{ steps.release.outputs.tag_name }}" >> $GITHUB_OUTPUT
echo "SLACK_MESSAGE=:alert: Failed to deploy cloudinary-video-player version ${{ steps.bump_version.outputs.new_version }}" >> $GITHUB_OUTPUT
echo "SLACK_FOOTER=See log here https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ github.job }}" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Slack Notification
if: steps.release.outputs.release_created
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ vars.FE_DEPLOYMENTS_SLACK_WEBHOOK }}
Expand All @@ -81,7 +91,6 @@ jobs:
SLACK_FOOTER: ${{ steps.set-messages.outputs.SLACK_FOOTER }}

- uses: gacts/purge-jsdelivr-cache@v1
if: steps.release.outputs.release_created
with:
url: |
https://cdn.jsdelivr.net/npm/cloudinary-video-player@edge
12 changes: 3 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: 🚀 Release

on:
push:
branches:
- 'master'
workflow_dispatch:

jobs:
Expand All @@ -12,22 +15,13 @@ jobs:

- run: npm ci

- name: Get releases
id: fetch-latest-release
uses: ./.github/actions/fetch-latest-release
with:
github-token: ${{ github.token }}
ignore-prereleases: true

- name: Release PR
uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.BOT_TOKEN }}
release-type: node
default-branch: master
release-search-depth: 20
last-release-sha: ${{ steps.fetch-latest-release.outputs.target_commitish }}

# The logic below handles the npm publication:
- uses: actions/setup-node@v4
Expand Down
Loading

0 comments on commit 62b2c30

Please sign in to comment.