Fire tune build steps for mv3 version

This commit is contained in:
Raymond Hill 2022-09-10 14:20:07 -04:00
parent dfde4643a2
commit c583a2e4b0
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
2 changed files with 30 additions and 9 deletions

View file

@ -49,6 +49,13 @@ jobs:
run: |
tools/make-mv3.sh full
echo "MV3PACKAGE=$(basename $(ls dist/build/uBlock0_*.mv3.zip))" >> $GITHUB_ENV
cp dist/build/uBlock0.mv3/log.txt dist/chromium-mv3/
- name: Commit MV3 build log file
# https://github.com/marketplace/actions/github-action-for-committing-changes-to-a-repository
uses: devops-infra/action-commit-push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: Update build log file
- name: Upload Chromium package
uses: actions/upload-release-asset@v1
env:

View file

@ -58,9 +58,6 @@ async function main() {
const rulesetDetails = [];
const outputDir = commandLineArgs.get('output') || '.';
let goodTotalCount = 0;
let maybeGoodTotalCount = 0;
const output = [];
const log = (text, silent = false) => {
output.push(text);
@ -69,6 +66,29 @@ async function main() {
}
};
// Get manifest content
const manifest = await fs.readFile(
`${outputDir}/manifest.json`,
{ encoding: 'utf8' }
).then(text =>
JSON.parse(text)
);
// Create unique version number according to build time
let version = manifest.version;
{
const now = new Date();
const yearPart = now.getUTCFullYear() - 2000;
const monthPart = (now.getUTCMonth() + 1) * 1000;
const dayPart = now.getUTCDate() * 10;
const hourPart = Math.floor(now.getUTCHours() / 3) + 1;
version += `.${yearPart}.${monthPart + dayPart + hourPart}`;
}
log(`Version: ${version}`);
let goodTotalCount = 0;
let maybeGoodTotalCount = 0;
const replacer = (k, v) => {
if ( k.startsWith('__') ) { return; }
if ( Array.isArray(v) ) {
@ -243,12 +263,6 @@ async function main() {
log(`Total regex rules count: ${maybeGoodTotalCount}`);
// Patch manifest
const manifest = await fs.readFile(
`${outputDir}/manifest.json`,
{ encoding: 'utf8' }
).then(text =>
JSON.parse(text)
);
manifest.declarative_net_request = { rule_resources: ruleResources };
const now = new Date();
const yearPart = now.getUTCFullYear() - 2000;