bitmovin-player-ui 3.52.2 → 3.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ ## Description
2
+ <!-- Add a short description about the changes -->
3
+
4
+ ## Checklist (for PR submitter and reviewers)
5
+ <!-- A PR with CHANGELOG entry will be released automatically -->
6
+ - [ ] `CHANGELOG` entry
@@ -0,0 +1,29 @@
1
+ const semver = require('semver');
2
+
3
+ function getPlayerUiVersion(versionInput) {
4
+ const playerUiVersion = semver.valid(versionInput);
5
+ if (!playerUiVersion) {
6
+ console.error(`${versionInput} is not a valid semver`);
7
+ process.exit(1);
8
+ }
9
+
10
+ return {
11
+ major: semver.major(playerUiVersion),
12
+ minor: semver.minor(playerUiVersion),
13
+ patch: semver.patch(playerUiVersion),
14
+ prereleaseLabels: semver.prerelease(playerUiVersion),
15
+ full: playerUiVersion,
16
+ };
17
+ }
18
+
19
+ function defineReleaseVersion({ core }, targetReleaseLevel, givenVersion) {
20
+ core.info(`Defining new release version for level ${targetReleaseLevel} and version ${givenVersion}`);
21
+
22
+ const newVersion = semver.inc(givenVersion, targetReleaseLevel);
23
+
24
+ const parsedPlayerVersion = getPlayerUiVersion(newVersion);
25
+ core.info(`Using release version ${parsedPlayerVersion.full}`);
26
+ return parsedPlayerVersion;
27
+ }
28
+
29
+ module.exports.defineReleaseVersion = defineReleaseVersion;
@@ -0,0 +1,79 @@
1
+ const fs = require('fs');
2
+ const https = require('https');
3
+
4
+ const jobStatus = process.argv[2];
5
+ const changelogPath = process.argv[3];
6
+ const slackWebhookUrl = process.argv[4];
7
+ const runId = process.argv[5];
8
+
9
+ const failureSlackChannelId = 'CGRK9DV7H';
10
+ const successSlackChannelId = 'C0LJ16JBS';
11
+
12
+ fs.readFile(changelogPath, 'utf8', (err, fileContent) => {
13
+ if (err) {
14
+ throw err;
15
+ }
16
+
17
+ const changelogContent = parseChangelogEntry(fileContent);
18
+ const releaseVersion = parseReleaseVersion(fileContent);
19
+ sendSlackMessage(releaseVersion, changelogContent);
20
+ });
21
+
22
+ function parseReleaseVersion(fileContent) {
23
+ const regex = /##\s\[(\d+\.\d+.\d+)\]/;
24
+ const releaseVersion = fileContent.match(regex);
25
+
26
+ return releaseVersion[1];
27
+ }
28
+
29
+ function parseChangelogEntry(fileContent) {
30
+ // The regex looks for the first paragraph starting with "###" until it finds
31
+ // a paragraph starting with "##".
32
+ // For some reason it also matches 2 chars at the end. With the .slice
33
+ // those 2 chars get removed from the string.
34
+ const regex = /###(.)*[\s\S]*?(?=\s##\s\[v*?)/;
35
+
36
+ let changelogContent = fileContent.match(regex);
37
+ changelogContent = changelogContent.slice(0, -1);
38
+ return changelogContent.toString();
39
+ }
40
+
41
+ function sendSlackMessage(releaseVersion, changelogContent) {
42
+ let message;
43
+ let slackChannelId;
44
+ if (jobStatus === 'success') {
45
+ slackChannelId = successSlackChannelId
46
+ message = `Changelog v${releaseVersion}\n${changelogContent}`
47
+ } else {
48
+ slackChannelId = failureSlackChannelId
49
+ message = `Release v${releaseVersion} failed.\nPlease check https://github.com/bitmovin/bitmovin-player-ui/actions/runs/${runId}`
50
+ }
51
+
52
+ const sampleData = JSON.stringify({
53
+ "channel": slackChannelId,
54
+ "message": message
55
+ });
56
+ const options = {
57
+ method: 'POST',
58
+ headers: {
59
+ 'Content-Type': 'application/json',
60
+ 'Accept': "application/json",
61
+ }
62
+ };
63
+
64
+ var req = https.request(slackWebhookUrl, options, (res) => {
65
+ console.log('statusCode:', res.statusCode);
66
+ console.log('headers:', res.headers);
67
+
68
+ res.on('data', (d) => {
69
+ process.stdout.write(d);
70
+ });
71
+ });
72
+
73
+ req.on('error', (e) => {
74
+ console.error(e);
75
+ });
76
+
77
+ req.write(sampleData);
78
+ req.end();
79
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Updates the changelog by replacing the changelog header with the correct version
3
+ *
4
+ * @param {string} changelogString the content of the changelog file
5
+ * @param {string} version the player version to be released
6
+ * @param {string} releaseDate the release date to be written to the changelog
7
+ */
8
+ function updateChangeLog(changelogString, version, releaseDate) {
9
+ const optionalBetaOrRc = '(-rc.d+)?(-(b|beta).d+)?';
10
+ const changelogVersionRegExp = new RegExp(
11
+ `\\[(development|develop|unreleased|${version})${optionalBetaOrRc}.*`,
12
+ 'gi',
13
+ );
14
+ return changelogString.replace(changelogVersionRegExp, `[${version}] - ${releaseDate}`);
15
+ }
16
+
17
+ module.exports.updateChangeLog = updateChangeLog;
@@ -16,7 +16,9 @@ jobs:
16
16
 
17
17
  steps:
18
18
  - name: Checkout
19
- uses: actions/checkout@v3
19
+ uses: actions/checkout@v4
20
+ with:
21
+ ref: develop
20
22
 
21
23
  - uses: actions/download-artifact@v3
22
24
  with:
@@ -32,3 +34,19 @@ jobs:
32
34
  env:
33
35
  NPM_DRY_RUN: false
34
36
  NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
37
+
38
+ - name: Notify team
39
+ run: node .github/scripts/notifySlackTeam.js 'success' 'CHANGELOG.md' ${{ secrets.RELEASE_SUCCESS_SLACK_WEBHOOK }}
40
+
41
+ handle_failure:
42
+ runs-on: ubuntu-latest
43
+ needs: [test_and_build, download_and_publish]
44
+ if: ${{ always() && (needs.download_and_publish.result == 'failure' || needs.test_and_build.result == 'failure') }}
45
+ steps:
46
+ - name: Checkout
47
+ uses: actions/checkout@v4
48
+ with:
49
+ ref: develop
50
+
51
+ - name: Notify team
52
+ run: node .github/scripts/notifySlackTeam.js 'failure' 'CHANGELOG.md' ${{ secrets.RELEASE_FAILURE_SLACK_WEBHOOK }} ${{ github.run_id }}
@@ -0,0 +1,74 @@
1
+ name: Trigger release on merge
2
+ run-name: Starting release for ${{ github.actor }} PR merge
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - closed
7
+ branches:
8
+ - develop
9
+
10
+ jobs:
11
+ trigger-ui-release:
12
+ if: github.event.pull_request.merged == true
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@v4
17
+ with:
18
+ ssh-key: ${{ secrets.RELEASE_DEPLOY_KEY }}
19
+ ref: develop
20
+
21
+ - name: Install dependencies
22
+ run: npm ci
23
+
24
+ - name: Read package.json version
25
+ uses: actions/github-script@v6
26
+ id: define-package-json-version
27
+ with:
28
+ script: |
29
+ const { version } = require('./package.json')
30
+ core.info(`performing a minor release for existing version ${version}`)
31
+ core.setOutput('packageJsonVersion', version)
32
+
33
+ - name: Define release version
34
+ uses: actions/github-script@v6
35
+ id: define-release-version
36
+ with:
37
+ script: |
38
+ const { defineReleaseVersion } = require('./.github/scripts/defineVersion.js')
39
+ return defineReleaseVersion({core}, 'minor', "${{ steps.define-package-json-version.outputs.packageJsonVersion }}" )
40
+
41
+ - name: Bump package.json version
42
+ run: |
43
+ git config --global user.name 'Automated Release'
44
+ git config --global user.email 'release-automation@bitmovin.com'
45
+ npm version "${{ fromJson(steps.define-release-version.outputs.result).full }}"
46
+
47
+ - name: Update Changelog
48
+ uses: actions/github-script@v6
49
+ with:
50
+ script: |
51
+ const fs = require('fs');
52
+ const { updateChangeLog } = require('./.github/scripts/updateChangelog.js')
53
+
54
+ const stableVersion = '${{ fromJson(steps.define-release-version.outputs.result).full }}'.split('-')[0]
55
+ const releaseDate = new Date().toISOString().split('T')[0]
56
+
57
+ const data = fs.readFileSync('./CHANGELOG.md',{encoding:'utf8', flag:'r'});
58
+
59
+ core.info(`Updating ${stableVersion} with date ${releaseDate} in Changelog`);
60
+
61
+ const changelogFileContents = updateChangeLog(data, stableVersion, releaseDate);
62
+
63
+ fs.writeFileSync('./CHANGELOG.md', changelogFileContents, 'utf-8');
64
+
65
+ - name: Push changes
66
+ run: |
67
+ git add .
68
+ git commit -m "Add release date to changelog"
69
+ git push origin develop
70
+ git push origin --tags
71
+
72
+ - name: Notify failure
73
+ if: ${{ failure() }}
74
+ run: node .github/scripts/notifySlackTeam.js 'failure' 'CHANGELOG.md' ${{ secrets.RELEASE_FAILURE_SLACK_WEBHOOK }} ${{ github.run_id }}
package/CHANGELOG.md CHANGED
@@ -4,7 +4,16 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
- ## [Unreleased]
7
+ ## [3.54.0] - 2024-02-01
8
+
9
+ ### Fixed
10
+ - FCC subtitle settings menu showing two options with the same value
11
+ - Invalid release workflow file
12
+
13
+ ## [3.53.0] - 2024-01-03
14
+
15
+ ### Added
16
+ - Automate release on every PR merge to develop
8
17
 
9
18
  ## [3.52.2] - 2023-11-23
10
19
 
Binary file