-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/reduce-forced-reflows
- Loading branch information
Showing
131 changed files
with
3,016 additions
and
697 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: Report a Bug | ||
url: https://dashboard.bitmovin.com/support/tickets | ||
about: Report a Bug you encountered in our Bitmovin Player UI in your Bitmovin Customer Dashboard. | ||
- name: Feature Requests | ||
url: https://community.bitmovin.com/t/how-to-submit-a-feature-request-to-us/1463 | ||
about: Learn how to suggest new features for our Player SDKs. | ||
- name: Report a security vulnerability | ||
url: https://bitmovin.atlassian.net/wiki/external/1502085332/YTYwODMwZjQyNjkwNGQ0ODg5MTgwM2NhMDliNjRmODE | ||
about: Report a security vulnerability. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Description | ||
<!-- Add a short description about the changes --> | ||
|
||
## Checklist (for PR submitter and reviewers) | ||
<!-- A PR with CHANGELOG entry will be released automatically --> | ||
<!-- This is required and should be added in every case --> | ||
- [ ] `CHANGELOG` entry |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const semver = require('semver'); | ||
|
||
function getPlayerUiVersion(versionInput) { | ||
const playerUiVersion = semver.valid(versionInput); | ||
if (!playerUiVersion) { | ||
console.error(`${versionInput} is not a valid semver`); | ||
process.exit(1); | ||
} | ||
|
||
return { | ||
major: semver.major(playerUiVersion), | ||
minor: semver.minor(playerUiVersion), | ||
patch: semver.patch(playerUiVersion), | ||
prereleaseLabels: semver.prerelease(playerUiVersion), | ||
full: playerUiVersion, | ||
}; | ||
} | ||
|
||
function defineReleaseVersion({ core }, targetReleaseLevel, givenVersion) { | ||
core.info(`Defining new release version for level ${targetReleaseLevel} and version ${givenVersion}`); | ||
|
||
const newVersion = semver.inc(givenVersion, targetReleaseLevel); | ||
|
||
const parsedPlayerVersion = getPlayerUiVersion(newVersion); | ||
core.info(`Using release version ${parsedPlayerVersion.full}`); | ||
return parsedPlayerVersion; | ||
} | ||
|
||
module.exports.defineReleaseVersion = defineReleaseVersion; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
const fs = require('fs'); | ||
const https = require('https'); | ||
|
||
const jobStatus = process.argv[2]; | ||
const changelogPath = process.argv[3]; | ||
const slackWebhookUrl = process.argv[4]; | ||
const runId = process.argv[5]; | ||
|
||
const failureSlackChannelId = 'CGRK9DV7H'; | ||
const successSlackChannelId = 'C0LJ16JBS'; | ||
|
||
fs.readFile(changelogPath, 'utf8', (err, fileContent) => { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
const changelogContent = parseChangelogEntry(fileContent); | ||
const releaseVersion = parseReleaseVersion(fileContent); | ||
sendSlackMessage(releaseVersion, changelogContent); | ||
}); | ||
|
||
function parseReleaseVersion(fileContent) { | ||
const regex = /##\s\[(\d+\.\d+.\d+)\]/; | ||
const releaseVersion = fileContent.match(regex); | ||
|
||
return releaseVersion[1]; | ||
} | ||
|
||
function parseChangelogEntry(fileContent) { | ||
// The regex looks for the first paragraph starting with "###" until it finds | ||
// a paragraph starting with "##". | ||
// For some reason it also matches 2 chars at the end. With the .slice | ||
// those 2 chars get removed from the string. | ||
const regex = /###(.)*[\s\S]*?(?=\s##\s\[v*?)/; | ||
|
||
let changelogContent = fileContent.match(regex); | ||
changelogContent = changelogContent.slice(0, -1); | ||
return changelogContent.toString(); | ||
} | ||
|
||
function sendSlackMessage(releaseVersion, changelogContent) { | ||
let message; | ||
let slackChannelId; | ||
if (jobStatus === 'success') { | ||
slackChannelId = successSlackChannelId | ||
message = `Changelog v${releaseVersion}\n${changelogContent}` | ||
} else { | ||
slackChannelId = failureSlackChannelId | ||
message = `Release v${releaseVersion} failed.\nPlease check https://github.com/bitmovin/bitmovin-player-ui/actions/runs/${runId}` | ||
} | ||
|
||
const sampleData = JSON.stringify({ | ||
"channel": slackChannelId, | ||
"message": message | ||
}); | ||
const options = { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Accept': "application/json", | ||
} | ||
}; | ||
|
||
var req = https.request(slackWebhookUrl, options, (res) => { | ||
console.log('statusCode:', res.statusCode); | ||
console.log('headers:', res.headers); | ||
|
||
res.on('data', (d) => { | ||
process.stdout.write(d); | ||
}); | ||
}); | ||
|
||
req.on('error', (e) => { | ||
console.error(e); | ||
}); | ||
|
||
req.write(sampleData); | ||
req.end(); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Updates the changelog by replacing the changelog header with the correct version | ||
* | ||
* @param {string} changelogString the content of the changelog file | ||
* @param {string} version the player version to be released | ||
* @param {string} releaseDate the release date to be written to the changelog | ||
*/ | ||
function updateChangeLog(changelogString, version, releaseDate) { | ||
const optionalBetaOrRc = '(-rc.d+)?(-(b|beta).d+)?'; | ||
const changelogVersionRegExp = new RegExp( | ||
`\\[(development|develop|unreleased|${version})${optionalBetaOrRc}.*`, | ||
'gi', | ||
); | ||
|
||
const lastReleaseVersion = changelogString.match(/## \[(\d+.\d+.\d+)\] - \d{4}-\d{2}-\d{2}/)[1]; | ||
const changelogWithReleaseVersionAndDate = changelogString.replace(changelogVersionRegExp, `[${version}] - ${releaseDate}`); | ||
|
||
return changelogWithReleaseVersionAndDate.replace( | ||
'## 1.0.0 (2017-02-03)\n- First release\n\n', | ||
`## 1.0.0 (2017-02-03)\n- First release\n\n[${version}]: https://github.com/bitmovin/bitmovin-player-ui/compare/v${lastReleaseVersion}...v${version}\n` | ||
); | ||
} | ||
|
||
module.exports.updateChangeLog = updateChangeLog; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Trigger release on merge | ||
run-name: Starting release for ${{ github.actor }} PR merge | ||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
trigger-ui-release: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ssh-key: ${{ secrets.RELEASE_DEPLOY_KEY }} | ||
ref: develop | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Read package.json version | ||
uses: actions/github-script@v6 | ||
id: define-package-json-version | ||
with: | ||
script: | | ||
const { version } = require('./package.json') | ||
core.info(`performing a minor release for existing version ${version}`) | ||
core.setOutput('packageJsonVersion', version) | ||
- name: Define release version | ||
uses: actions/github-script@v6 | ||
id: define-release-version | ||
with: | ||
script: | | ||
const { defineReleaseVersion } = require('./.github/scripts/defineVersion.js') | ||
return defineReleaseVersion({core}, 'minor', "${{ steps.define-package-json-version.outputs.packageJsonVersion }}" ) | ||
- name: Bump package.json version | ||
run: | | ||
git config --global user.name 'Automated Release' | ||
git config --global user.email '[email protected]' | ||
npm version "${{ fromJson(steps.define-release-version.outputs.result).full }}" | ||
- name: Update Changelog | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const fs = require('fs'); | ||
const { updateChangeLog } = require('./.github/scripts/updateChangelog.js') | ||
const stableVersion = '${{ fromJson(steps.define-release-version.outputs.result).full }}'.split('-')[0] | ||
const releaseDate = new Date().toISOString().split('T')[0] | ||
const data = fs.readFileSync('./CHANGELOG.md',{encoding:'utf8', flag:'r'}); | ||
core.info(`Updating ${stableVersion} with date ${releaseDate} in Changelog`); | ||
const changelogFileContents = updateChangeLog(data, stableVersion, releaseDate); | ||
fs.writeFileSync('./CHANGELOG.md', changelogFileContents, 'utf-8'); | ||
- name: Push changes | ||
run: | | ||
git add . | ||
git commit -m "Add release date to changelog" | ||
git push origin develop | ||
git push origin --tags | ||
- name: Notify failure | ||
if: ${{ failure() }} | ||
run: node .github/scripts/notifySlackTeam.js 'failure' 'CHANGELOG.md' ${{ secrets.RELEASE_FAILURE_SLACK_WEBHOOK }} ${{ github.run_id }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -416,3 +416,4 @@ jspm_packages | |
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
docs |
Oops, something went wrong.