Skip to content

Commit b1c2447

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/min-document-2.19.2
2 parents 3c781d5 + 620b4a0 commit b1c2447

File tree

4 files changed

+115
-41
lines changed

4 files changed

+115
-41
lines changed

.github/workflows/npm-publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 📦 NPM Publish
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
description: 'NPM tag to publish with (e.g., "edge"). Leave empty for latest.'
8+
required: false
9+
type: string
10+
default: ''
11+
ref:
12+
description: 'Git ref to checkout (branch, tag, or SHA). Leave empty for default.'
13+
required: false
14+
type: string
15+
default: ''
16+
workflow_dispatch:
17+
inputs:
18+
tag:
19+
description: 'NPM tag to publish with (e.g., "edge"). Leave empty for latest.'
20+
required: false
21+
type: string
22+
default: ''
23+
ref:
24+
description: 'Git ref to checkout (branch, tag, or SHA). Leave empty for default.'
25+
required: false
26+
type: string
27+
default: ''
28+
29+
jobs:
30+
publish:
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: read
34+
id-token: write
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
with:
39+
ref: ${{ inputs.ref || github.ref }}
40+
41+
- uses: actions/setup-node@v4
42+
with:
43+
node-version: '20.x'
44+
registry-url: 'https://registry.npmjs.org'
45+
46+
- run: npm ci
47+
48+
- run: npm run build-all
49+
50+
- name: Publish to NPM
51+
run: |
52+
if [ -n "${{ inputs.tag }}" ]; then
53+
npm publish --tag ${{ inputs.tag }} --provenance --access public
54+
else
55+
npm publish --provenance --access public
56+
fi

.github/workflows/release-edge.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
release:
10+
prepare:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
outputs:
15+
edge_branch: ${{ steps.get_next_version.outputs.version }}-edge
16+
new_version: ${{ steps.bump_version.outputs.new_version }}
1217

1318
steps:
1419
- uses: actions/checkout@v4
@@ -62,24 +67,34 @@ jobs:
6267
run: |
6368
git push origin ${{ steps.get_next_version.outputs.version }}-edge
6469
65-
- run: npm run build-all
70+
publish:
71+
needs: prepare
72+
uses: ./.github/workflows/npm-publish.yml
73+
with:
74+
tag: edge
75+
ref: ${{ needs.prepare.outputs.edge_branch }}
6676

67-
- name: Publish ${{ steps.bump_version.outputs.new_version }}
68-
run: npm publish --tag edge
69-
env:
70-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
77+
notify:
78+
needs: [prepare, publish]
79+
if: always()
80+
runs-on: ubuntu-latest
81+
82+
steps:
83+
- uses: actions/checkout@v4
7184

7285
- name: Set Notification Messages
7386
id: set-messages
7487
run: |
75-
if [[ ${{ job.status }} == "success" ]]; then
76-
echo "SLACK_TITLE=Video Player ${{ steps.bump_version.outputs.new_version }} Deployed" >> $GITHUB_OUTPUT
77-
echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version ${{ steps.bump_version.outputs.new_version }} deployed successfully" >> $GITHUB_OUTPUT
88+
if [[ "${{ needs.publish.result }}" == "success" ]]; then
89+
echo "SLACK_TITLE=Video Player ${{ needs.prepare.outputs.new_version }} Deployed" >> $GITHUB_OUTPUT
90+
echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version ${{ needs.prepare.outputs.new_version }} deployed successfully" >> $GITHUB_OUTPUT
7891
echo "SLACK_FOOTER=Check it out at https://cloudinary.github.io/cloudinary-video-player/?ver=edge&min=true" >> $GITHUB_OUTPUT
92+
echo "SLACK_COLOR=good" >> $GITHUB_OUTPUT
7993
else
8094
echo "SLACK_TITLE=Video Player Deployment Failed" >> $GITHUB_OUTPUT
81-
echo "SLACK_MESSAGE=:alert: Failed to deploy cloudinary-video-player version ${{ steps.bump_version.outputs.new_version }}" >> $GITHUB_OUTPUT
82-
echo "SLACK_FOOTER=See log here https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ github.job }}" >> $GITHUB_OUTPUT
95+
echo "SLACK_MESSAGE=:alert: Failed to deploy cloudinary-video-player version ${{ needs.prepare.outputs.new_version }}" >> $GITHUB_OUTPUT
96+
echo "SLACK_FOOTER=See log here https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT
97+
echo "SLACK_COLOR=danger" >> $GITHUB_OUTPUT
8398
fi
8499
shell: bash
85100

@@ -88,12 +103,13 @@ jobs:
88103
env:
89104
SLACK_WEBHOOK: ${{ vars.FE_DEPLOYMENTS_SLACK_WEBHOOK }}
90105
SLACK_CHANNEL: 'rnd-fe-releases'
91-
SLACK_COLOR: ${{ job.status }}
106+
SLACK_COLOR: ${{ steps.set-messages.outputs.SLACK_COLOR }}
92107
SLACK_TITLE: ${{ steps.set-messages.outputs.SLACK_TITLE }}
93108
SLACK_MESSAGE: ${{ steps.set-messages.outputs.SLACK_MESSAGE }}
94109
SLACK_FOOTER: ${{ steps.set-messages.outputs.SLACK_FOOTER }}
95110

96111
- name: Purge jsDelivr Cache
112+
if: ${{ needs.publish.result == 'success' }}
97113
uses: ./.github/actions/purge-jsdelivr
98114
with:
99115
package: cloudinary-video-player@edge

.github/workflows/release.yml

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
jobs:
1010
release:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
1218

1319
steps:
1420
- uses: actions/checkout@v4
@@ -23,49 +29,47 @@ jobs:
2329
release-type: node
2430
default-branch: master
2531

26-
# The logic below handles the npm publication:
27-
- uses: actions/setup-node@v4
28-
with:
29-
node-version: '20.x'
30-
registry-url: 'https://registry.npmjs.org'
31-
# these if statements ensure that a publication only occurs when
32-
# a new release is created:
33-
if: ${{ steps.release.outputs.release_created }}
34-
- run: npm run build-all
35-
if: ${{ steps.release.outputs.release_created }}
36-
- run: npm publish
37-
env:
38-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
39-
if: ${{ steps.release.outputs.release_created }}
32+
publish:
33+
needs: release
34+
if: ${{ needs.release.outputs.release_created == 'true' }}
35+
uses: ./.github/workflows/npm-publish.yml
36+
37+
notify:
38+
needs: [release, publish]
39+
if: ${{ always() && needs.release.outputs.release_created == 'true' }}
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v4
4044

4145
- name: Set Notification Messages
42-
if: steps.release.outputs.release_created
4346
id: set-messages
4447
run: |
45-
if [[ ${{ job.status }} == "success" ]]; then
46-
echo "SLACK_TITLE=Video Player ${{ steps.release.outputs.tag_name }} Deployed" >> $GITHUB_OUTPUT
47-
echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version ${{ steps.release.outputs.tag_name }} deployed successfully" >> $GITHUB_OUTPUT
48+
if [[ "${{ needs.publish.result }}" == "success" ]]; then
49+
echo "SLACK_TITLE=Video Player ${{ needs.release.outputs.tag_name }} Deployed" >> $GITHUB_OUTPUT
50+
echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version ${{ needs.release.outputs.tag_name }} deployed successfully" >> $GITHUB_OUTPUT
4851
echo "SLACK_FOOTER=Check it out at https://cloudinary.github.io/cloudinary-video-player/?ver=latest&min=true" >> $GITHUB_OUTPUT
52+
echo "SLACK_COLOR=good" >> $GITHUB_OUTPUT
4953
else
5054
echo "SLACK_TITLE=Video Player Deployment Failed" >> $GITHUB_OUTPUT
51-
echo "SLACK_MESSAGE=:alert: Failed to deploy cloudinary-video-player version ${{ steps.release.outputs.tag_name }}" >> $GITHUB_OUTPUT
52-
echo "SLACK_FOOTER=See log here https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ github.job }}" >> $GITHUB_OUTPUT
55+
echo "SLACK_MESSAGE=:alert: Failed to deploy cloudinary-video-player version ${{ needs.release.outputs.tag_name }}" >> $GITHUB_OUTPUT
56+
echo "SLACK_FOOTER=See log here https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_OUTPUT
57+
echo "SLACK_COLOR=danger" >> $GITHUB_OUTPUT
5358
fi
5459
shell: bash
5560

5661
- name: Slack Notification
57-
if: steps.release.outputs.release_created
5862
uses: rtCamp/action-slack-notify@v2.2.0
5963
env:
6064
SLACK_WEBHOOK: ${{ vars.FE_DEPLOYMENTS_SLACK_WEBHOOK }}
6165
SLACK_CHANNEL: 'rnd-fe-releases'
62-
SLACK_COLOR: ${{ job.status }}
66+
SLACK_COLOR: ${{ steps.set-messages.outputs.SLACK_COLOR }}
6367
SLACK_TITLE: ${{ steps.set-messages.outputs.SLACK_TITLE }}
6468
SLACK_MESSAGE: ${{ steps.set-messages.outputs.SLACK_MESSAGE }}
6569
SLACK_FOOTER: ${{ steps.set-messages.outputs.SLACK_FOOTER }}
6670

6771
- name: Purge jsDelivr Cache
68-
if: steps.release.outputs.release_created
72+
if: ${{ needs.publish.result == 'success' }}
6973
uses: ./.github/actions/purge-jsdelivr
7074
with:
7175
package: cloudinary-video-player

src/utils/get-analytics-player-options.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import defaults from 'config/defaults';
22
import isEmpty from 'lodash/isEmpty';
3-
import isObject from 'lodash/isObject';
43

54
const hasConfig = (obj) => isEmpty(obj) ? null : true;
65

@@ -44,7 +43,7 @@ const getSourceOptions = (sourceOptions = {}) => ({
4443
} : {}),
4544
...(hasConfig(sourceOptions.textTracks) ? getTextTracksOptions(sourceOptions.textTracks) : {}),
4645
interactionAreas: hasConfig(sourceOptions.interactionAreas),
47-
videoSources: !!sourceOptions.videoSources || null,
46+
videoSources: hasConfig(sourceOptions.videoSources),
4847
});
4948

5049
const getTextTracksOptions = (textTracks = {}) => {
@@ -96,8 +95,7 @@ export const getAnalyticsFromPlayerOptions = (playerOptions) => filterDefaultsAn
9695
autoplayMode: playerOptions.autoplayMode,
9796
bigPlayButton: playerOptions.bigPlayButton,
9897
className: playerOptions.class,
99-
cloudinaryAnalytics: !!playerOptions.cloudinaryAnalytics,
100-
cloudinaryAnalyticsOptions: isObject(playerOptions.cloudinaryAnalytics) || null,
98+
cloudinaryAnalytics: hasConfig(playerOptions.cloudinaryAnalytics),
10199
controls: playerOptions.controls,
102100
floatingWhenNotVisible: playerOptions.floatingWhenNotVisible,
103101
fluid: playerOptions.fluid,
@@ -126,8 +124,8 @@ export const getAnalyticsFromPlayerOptions = (playerOptions) => filterDefaultsAn
126124
debug: playerOptions.debug,
127125
type: playerOptions.type,
128126

129-
colors: playerOptions.colors && JSON.stringify(playerOptions.colors),
130-
controlBar: (JSON.stringify(playerOptions.controlBar) !== JSON.stringify(defaults.controlBar)) && JSON.stringify(playerOptions.controlBar),
127+
colors: hasConfig(playerOptions.colors),
128+
controlBar: hasConfig(playerOptions.controlBar),
131129

132130
...getSourceOptions(playerOptions.sourceOptions || {}),
133131
...getAdsOptions(playerOptions.ads),

0 commit comments

Comments
 (0)