Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update version roll script #2550

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/update-browser-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ jobs:
- name: Update browser pin and devtools-protocol
run: node tools/update_chrome_revision.mjs
- name: Create Pull Request
if: ${{ steps.update.outputs.commit }}
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
token: ${{ secrets.BROWSER_AUTOMATION_BOT_TOKEN }}
branch: browser-automation-bot/update-browser-version
delete-branch: true
committer: Browser Automation Bot <[email protected]>
author: Browser Automation Bot <[email protected]>
commit-message: 'build(chrome): update the pinned browser version'
title: 'build(chrome): update the pinned browser version'
commit-message: ${{ steps.update.outputs.commit }}
title: ${{ steps.update.outputs.commit }}
body: 'Automatically generated by https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/.github/workflows/update-browser-version.yml'
push-to-fork: browser-automation-bot/chromium-bidi
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"rollup": "4.21.0",
"rollup-plugin-license": "3.5.2",
"selenium-webdriver": "4.23.0",
"semver": "7.6.3",
"sinon": "18.0.0",
"source-map-support": "0.5.21",
"tslib": "2.7.0",
Expand Down
26 changes: 26 additions & 0 deletions tools/update_chrome_revision.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import {execSync} from 'child_process';
import {writeFile, readFile} from 'fs/promises';

import actions from '@actions/core';
import {SemVer} from 'semver';

import packageJson from '../package.json' assert {type: 'json'};

async function getVersionAndRevisionForCanary() {
Expand Down Expand Up @@ -57,7 +60,30 @@ async function updateDevToolsProtocolVersion(revision) {
await writeFile('./package.json', update);
}

const currentVersion = (await readFile('./browser', 'utf8')).split('@').pop();
console.log(`Current pinned version is: ${currentVersion}`);

const {version, revision} = await getVersionAndRevisionForCanary();

const oldSemVer = new SemVer(currentVersion, true);
const newSemVer = new SemVer(version, true);

let message = `update the pinned browser version to ${version}`;

if (newSemVer.compare(oldSemVer) <= 0) {
// Exit the process without setting up version
console.warn(
`Version ${version} is older or the same as the current ${currentVersion}`
);
process.exit(0);
} else if (newSemVer.major === oldSemVer.major) {
message = `build(chrome): ${message}`;
} else {
message = `feat(chrome): ${message}`;
}

actions.setOutput('commit', message);

console.log(`Chrome Canary version is: ${version} (${revision})`);
await updateDevToolsProtocolVersion(revision);

Expand Down
Loading