From c583a2e4b00d78a8563daccb6a7a2434b35aa1ae Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 10 Sep 2022 14:20:07 -0400 Subject: [PATCH] Fire tune build steps for mv3 version --- .github/workflows/main.yml | 7 +++++++ platform/mv3/make-rulesets.js | 32 +++++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 25ea171fd..788029ac3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: diff --git a/platform/mv3/make-rulesets.js b/platform/mv3/make-rulesets.js index 691d21dde..130a74984 100644 --- a/platform/mv3/make-rulesets.js +++ b/platform/mv3/make-rulesets.js @@ -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;