From 098d8d5cd692ce43b5355f51430e33c1cf98381c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:46:58 +0000 Subject: Bump ad-m/github-push-action Bumps [ad-m/github-push-action](https://github.com/ad-m/github-push-action) from 0fafdd62b84042d49ec0cb92d9cac7f7ce4ec79e to 9a2e3c14aaecf56d5816dc3a54514f82050820b2. - [Release notes](https://github.com/ad-m/github-push-action/releases) - [Commits](https://github.com/ad-m/github-push-action/compare/0fafdd62b84042d49ec0cb92d9cac7f7ce4ec79e...9a2e3c14aaecf56d5816dc3a54514f82050820b2) --- updated-dependencies: - dependency-name: ad-m/github-push-action dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/publish-firefox-development.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/publish-firefox-development.yml b/.github/workflows/publish-firefox-development.yml index 6a4e6ce8..f69960aa 100644 --- a/.github/workflows/publish-firefox-development.yml +++ b/.github/workflows/publish-firefox-development.yml @@ -83,6 +83,6 @@ jobs: git commit -a -m "${{ github.event.release.name }} - ${{ github.event.release.html_url }}" - name: Push changes - uses: ad-m/github-push-action@0fafdd62b84042d49ec0cb92d9cac7f7ce4ec79e # pin@master + uses: ad-m/github-push-action@9a2e3c14aaecf56d5816dc3a54514f82050820b2 # pin@master with: branch: metadata -- cgit v1.2.3 From 330e6e3c1b0dc55eadb280591a1db1a440266ebf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 19 Aug 2023 07:34:59 +0000 Subject: Bump github/codeql-action from 2.2.9 to 2.21.4 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.9 to 2.21.4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/04df1262e6247151b5ac09cd2c303ac36ad3f62b...a09933a12a80f87b87005513f0abb1494c27a716) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index ac07d2d7..0351f75c 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -63,6 +63,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@04df1262e6247151b5ac09cd2c303ac36ad3f62b # v2.2.9 + uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4 with: sarif_file: results.sarif -- cgit v1.2.3 From 5ad89cbdef5c3b439210d329462c60b58715875e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 19 Aug 2023 08:27:13 +0000 Subject: Bump ossf/scorecard-action from 2.1.3 to 2.2.0 Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.1.3 to 2.2.0. - [Release notes](https://github.com/ossf/scorecard-action/releases) - [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md) - [Commits](https://github.com/ossf/scorecard-action/compare/80e868c13c90f172d68d1f4501dee99e2479f7af...08b4669551908b1024bb425080c797723083c031) --- updated-dependencies: - dependency-name: ossf/scorecard-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 0351f75c..21927f18 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -33,7 +33,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@80e868c13c90f172d68d1f4501dee99e2479f7af # v2.1.3 + uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0 with: results_file: results.sarif results_format: sarif -- cgit v1.2.3 From 32c1928885be4a2d822c4105216becfa90455e99 Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sat, 19 Aug 2023 19:26:29 +0900 Subject: Fix typo in publish-firefox-development.yml --- .github/workflows/publish-firefox-development.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/publish-firefox-development.yml b/.github/workflows/publish-firefox-development.yml index f69960aa..8d8cd616 100644 --- a/.github/workflows/publish-firefox-development.yml +++ b/.github/workflows/publish-firefox-development.yml @@ -49,8 +49,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ inputs.upload_url }} - asset_path: yomitan-firefox.xpi - asset_name: yomitan-firefox.xpi + asset_path: yomitan-firefox-dev.xpi + asset_name: yomitan-firefox-dev.xpi asset_content_type: application/x-xpinstall # update update.json so that all people who have the dev version installed get the new update -- cgit v1.2.3 From bfe6c06c486d6fb522d252cb4660eb9f496428cc Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sat, 19 Aug 2023 16:55:11 +0900 Subject: Fix caching and fonts in playwright.yml When playwright is installed (i.e., not pulled from cache), the `--with-deps` flag causes it to pull in system dependencies as well. That makes the current caching strategy incoherent, as those dependencies will not be part of the cache as defined. Causing different behavior when pulling from cache vs installing fresh. In particular, some of the dependencies it pulls in are fonts, which causes the output of the test to change due to the available fonts changing. In fact, fonts are the _only_ dependencies it pulls in, everything else is already present in the stock ubuntu image. So it seems fine to just remove `--with-deps` and just pull in the image. If we discover we need system deps at any point, we can use `npx playwright install-deps chromium` in a separate command to pull in those deps, and figure out an alternate caching strategy fo rthem. --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 9397e4fa..a1135157 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -39,7 +39,7 @@ jobs: - if: ${{ steps.cache-playwright.outputs.cache-hit != 'true' }} name: Install Playwright Browsers - run: npx playwright install --with-deps chromium + run: npx playwright install chromium - name: Grab latest dictionaries from dictionaries branch uses: actions/checkout@v3 -- cgit v1.2.3 From dea8898c9dbfefde038c1648580efd25f974126f Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 20 Aug 2023 11:21:42 +0900 Subject: Use a fine-grained PAT in scorecard.yml For additional checks in the scorecard, such as branch protection checks. --- .github/workflows/scorecard.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 21927f18..cb9db177 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -16,6 +16,7 @@ permissions: read-all jobs: analysis: name: Scorecard analysis + environment: scorecard runs-on: ubuntu-latest permissions: # Needed to upload the results to code-scanning dashboard. @@ -41,7 +42,7 @@ jobs: # - you want to enable the Branch-Protection check on a *public* repository, or # - you are installing Scorecard on a *private* repository # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. - # repo_token: ${{ secrets.SCORECARD_TOKEN }} + repo_token: ${{ secrets.SCORECARD_TOKEN }} # Public repositories: # - Publish results to OpenSSF REST API for easy access by consumers -- cgit v1.2.3 From 54cef9a1f840096937521dd905126f060a4d3eee Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 20 Aug 2023 18:38:08 +0900 Subject: Use custom CodeQL workflow --- .github/workflows/codeql.yml | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/codeql.yml (limited to '.github/workflows') diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..a06541ca --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,82 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '31 13 * * 3' + +jobs: + analyze: + name: Analyze + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" -- cgit v1.2.3 From 0a5c9c3cf01b623db650140c761adcd6c7c4e26b Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 20 Aug 2023 19:19:02 +0900 Subject: Auto-approve safe PRs --- .github/workflows/auto-approve.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/auto-approve.yml (limited to '.github/workflows') diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml new file mode 100644 index 00000000..05523ae3 --- /dev/null +++ b/.github/workflows/auto-approve.yml @@ -0,0 +1,15 @@ +name: Auto-Approve Safe PRs + +on: pull_request_target + +jobs: + auto-approve: + runs-on: ubuntu-latest + environment: themoeway-bot + permissions: + pull-requests: write + if: github.actor == 'djahandarie' + steps: + - uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 + with: + github-token: ${{ secrets.THEMOEWAY_BOT_PAT }} -- cgit v1.2.3 From 032599f8c1c344c5592c5562029d98c6ed869c4d Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 20 Aug 2023 20:27:43 +0900 Subject: Fix auto-approval CI workflow --- .github/workflows/auto-approve-run.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/auto-approve.yml | 19 ++++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/auto-approve-run.yml (limited to '.github/workflows') diff --git a/.github/workflows/auto-approve-run.yml b/.github/workflows/auto-approve-run.yml new file mode 100644 index 00000000..e0605a42 --- /dev/null +++ b/.github/workflows/auto-approve-run.yml @@ -0,0 +1,29 @@ +name: Auto-Approve Safe PRs (workflow-run) +on: + workflow_run: + workflows: [Auto-Approve Safe PRs] + types: + - completed +jobs: + auto-approve-run: + runs-on: ubuntu-latest + environment: themoeway-bot + permissions: + pull-requests: write + if: github.actor == 'djahandarie' + steps: + - name: Download workflow artifact + uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: auto-approve.yml + run_id: ${{ github.event.workflow_run.id }} + - name: Read the pr_num file + id: pr_num_reader + uses: juliangruber/read-file-action@02bbba9876a8f870efd4ad64e3b9088d3fb94d4b # v1.1.6 + with: + path: ./pr_num/pr_num.txt + - uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 + with: + pull-request-number: ${{ steps.pr_num_reader.outputs.content }} + github-token: ${{ secrets.THEMOEWAY_BOT_PAT }} diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 05523ae3..5dd3831d 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,15 +1,16 @@ name: Auto-Approve Safe PRs - -on: pull_request_target - +on: pull_request jobs: auto-approve: runs-on: ubuntu-latest - environment: themoeway-bot - permissions: - pull-requests: write - if: github.actor == 'djahandarie' steps: - - uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 + - name: Save the PR number in an artifact + shell: bash + env: + PR_NUM: ${{ github.event.number }} + run: echo $PR_NUM > pr_num.txt + - name: Upload the PR number + uses: actions/upload-artifact@v2 with: - github-token: ${{ secrets.THEMOEWAY_BOT_PAT }} + name: pr_num + path: ./pr_num.txt \ No newline at end of file -- cgit v1.2.3 From 66f491f171bf6d9b8f2abe8fc2f5d9dd90ef9edb Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 20 Aug 2023 20:48:27 +0900 Subject: Restrict workflow permissions to satisfy OSSF Scorecard --- .github/workflows/auto-approve-run.yml | 1 + .github/workflows/auto-approve.yml | 1 + 2 files changed, 2 insertions(+) (limited to '.github/workflows') diff --git a/.github/workflows/auto-approve-run.yml b/.github/workflows/auto-approve-run.yml index e0605a42..45c169ba 100644 --- a/.github/workflows/auto-approve-run.yml +++ b/.github/workflows/auto-approve-run.yml @@ -4,6 +4,7 @@ on: workflows: [Auto-Approve Safe PRs] types: - completed +permissions: {} jobs: auto-approve-run: runs-on: ubuntu-latest diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 5dd3831d..250903fc 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,5 +1,6 @@ name: Auto-Approve Safe PRs on: pull_request +permissions: {} jobs: auto-approve: runs-on: ubuntu-latest -- cgit v1.2.3 From 0a3420b9b57a96cbb5b7712951870db97bbdc822 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 03:15:51 +0000 Subject: Bump actions/upload-artifact from 2 to 3 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-approve.yml | 2 +- .github/workflows/scorecard.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 250903fc..7e67a92b 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -11,7 +11,7 @@ jobs: PR_NUM: ${{ github.event.number }} run: echo $PR_NUM > pr_num.txt - name: Upload the PR number - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: pr_num path: ./pr_num.txt \ No newline at end of file diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index cb9db177..b03b17b4 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -56,7 +56,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@v3 # v3.1.0 with: name: SARIF file path: results.sarif -- cgit v1.2.3 From 8e577410677a84957d86ac0423784fc7fda3c09f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Aug 2023 03:22:54 +0000 Subject: Bump ad-m/github-push-action Bumps [ad-m/github-push-action](https://github.com/ad-m/github-push-action) from 9a2e3c14aaecf56d5816dc3a54514f82050820b2 to 29f05e01bb17e6f28228b47437e03a7b69e1f9ef. - [Release notes](https://github.com/ad-m/github-push-action/releases) - [Commits](https://github.com/ad-m/github-push-action/compare/9a2e3c14aaecf56d5816dc3a54514f82050820b2...29f05e01bb17e6f28228b47437e03a7b69e1f9ef) --- updated-dependencies: - dependency-name: ad-m/github-push-action dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/publish-firefox-development.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/publish-firefox-development.yml b/.github/workflows/publish-firefox-development.yml index 8d8cd616..234ef8b0 100644 --- a/.github/workflows/publish-firefox-development.yml +++ b/.github/workflows/publish-firefox-development.yml @@ -83,6 +83,6 @@ jobs: git commit -a -m "${{ github.event.release.name }} - ${{ github.event.release.html_url }}" - name: Push changes - uses: ad-m/github-push-action@9a2e3c14aaecf56d5816dc3a54514f82050820b2 # pin@master + uses: ad-m/github-push-action@29f05e01bb17e6f28228b47437e03a7b69e1f9ef # pin@master with: branch: metadata -- cgit v1.2.3 From 6f24ac4e2a1ee8928e0be69bea774bcade28f2a9 Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sat, 23 Sep 2023 18:05:33 +0900 Subject: Remove hardcoded version from manifest * Dynamically set version as argument to build script * Set version using tag ref_name in CI * [Cleanup] gitignore ext/manifest.json as it's dynamically generated --- .github/workflows/ci.yml | 9 +- .github/workflows/create-prerelease-on-tag.yml | 2 +- .github/workflows/playwright.yml | 9 +- .gitignore | 1 + CONTRIBUTING.md | 10 +- dev/build.js | 12 ++- dev/data/manifest-variants.json | 2 +- ext/manifest.json | 131 ------------------------- 8 files changed, 23 insertions(+), 153 deletions(-) delete mode 100644 ext/manifest.json (limited to '.github/workflows') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c62c9893..1b81df2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,16 +41,11 @@ jobs: env: CI: true - - name: Manifest - run: npm run test-manifest - env: - CI: true + - name: Build + run: npm run build - name: Validate manifest.json of the extension uses: cardinalby/schema-validator-action@c2da05377e89dd0c9b7be9420da0b3534b1efcce # pin@v1 with: file: ext/manifest.json schema: "https://json.schemastore.org/chrome-manifest.json" - - - name: Build - run: npm run test-build diff --git a/.github/workflows/create-prerelease-on-tag.yml b/.github/workflows/create-prerelease-on-tag.yml index 06cb8c7e..0999c5ec 100644 --- a/.github/workflows/create-prerelease-on-tag.yml +++ b/.github/workflows/create-prerelease-on-tag.yml @@ -21,7 +21,7 @@ jobs: node-version-file: ".node-version" - name: Lint - run: npm run-script build + run: npm run-script build -- --yomitan-version ${{ github.ref_name }} shell: bash - name: Release diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index a1135157..8efc184a 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -14,13 +14,13 @@ jobs: run: rm -rf /usr/share/fonts - uses: actions/checkout@v3 - + - name: Install CJK fonts uses: awalsh128/cache-apt-pkgs-action@1850ee53f6e706525805321a3f2f863dcf73c962 # v1.3.0 with: packages: fonts-ipafont-mincho execute_install_scripts: true - + - uses: actions/setup-node@v3 with: cache: "npm" @@ -29,6 +29,9 @@ jobs: - name: Install dependencies run: npm ci + - name: Build + run: npm run build + - name: Cache playwright browsers id: cache-playwright uses: actions/cache@v3 @@ -40,7 +43,7 @@ jobs: - if: ${{ steps.cache-playwright.outputs.cache-hit != 'true' }} name: Install Playwright Browsers run: npx playwright install chromium - + - name: Grab latest dictionaries from dictionaries branch uses: actions/checkout@v3 with: diff --git a/.gitignore b/.gitignore index d4e5da07..405fead0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ dictionaries/ /playwright-report/ /playwright/.cache/ /test/playwright/__screenshots__/ +ext/manifest.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffc76b74..b67f6092 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,9 +50,10 @@ Several command line arguments are available for these scripts: * `[target]` - Builds a specific target. * `--all` - Builds all targets specified in [manifest-variants.json](dev/data/manifest-variants.json). * `--default` - Restores the default manifest file. -* `--manifest ` - Overwrites [ext/manifest.json](ext/manifest.json) with the manifest variant for the specified build target. +* `--manifest ` - Overwrites `ext/manifest.json` with the manifest variant for the specified build target. * `--dry-run` - Runs the full build process (excluding zip building), checking that the configuration is valid. * `--dry-run-build-zip` - If `--dry-run` is also specified, zip building will also be performed in memory; no files are created. +* `--yomitan-version ` - Sets the version number in the extension manifest. Defaults to 0.0.0.0 if not set. If no arguments are specified, the command is equivalent to `build.bat --all`. @@ -66,11 +67,8 @@ Otherwise, the [JSZip](https://stuk.github.io/jszip/) API is used to generate th ## Manifest Manifest variants for different build targets are specified in [manifest-variants.json](dev/data/manifest-variants.json). -This file is used to overwrite the [manfiest.json](ext/manifest.json) file included in the extension. -By default, this manifest should be the default `chrome` manifest, and changes to [manfiest.json](ext/manifest.json) should not be committed -unless there is a corresponding change in [manifest-variants.json](dev/data/manifest-variants.json). -There is a continuous integration test which validates this, and the default manifest can be restored by running -`build.bat --default`. +This file is used to generate the `ext/manifest.json` file included in the extension. +The generated `ext/manfiest.json` should not be committed. ## Style diff --git a/dev/build.js b/dev/build.js index 5222c4c8..24b1e2d0 100644 --- a/dev/build.js +++ b/dev/build.js @@ -108,7 +108,7 @@ function getIndexOfFilePath(array, item) { return -1; } -async function build(buildDir, extDir, manifestUtil, variantNames, manifestPath, dryRun, dryRunBuildZip) { +async function build(buildDir, extDir, manifestUtil, variantNames, manifestPath, dryRun, dryRunBuildZip, yomitanVersion) { const sevenZipExes = ['7za', '7z']; // Create build directory @@ -130,6 +130,8 @@ async function build(buildDir, extDir, manifestUtil, variantNames, manifestPath, process.stdout.write(message); }; + process.stdout.write(`Version: ${yomitanVersion}...\n`); + for (const variantName of variantNames) { const variant = manifestUtil.getVariant(variantName); if (typeof variant === 'undefined' || variant.buildable === false) { continue; } @@ -148,7 +150,7 @@ async function build(buildDir, extDir, manifestUtil, variantNames, manifestPath, const fileNameSafe = path.basename(fileName); const fullFileName = path.join(buildDir, fileNameSafe); if (!dryRun) { - fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(modifiedManifest)); + fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(modifiedManifest).replace('$YOMITAN_VERSION', yomitanVersion)); } if (!dryRun || dryRunBuildZip) { @@ -183,11 +185,13 @@ async function main(argv) { ['manifest', null], ['dry-run', false], ['dry-run-build-zip', false], + ['yomitan-version', '0.0.0.0'], [null, []] ])); const dryRun = args.get('dry-run'); const dryRunBuildZip = args.get('dry-run-build-zip'); + const yomitanVersion = args.get('yomitan-version'); const manifestUtil = new ManifestUtil(); @@ -202,14 +206,14 @@ async function main(argv) { manifestUtil.getVariants().filter(({buildable}) => buildable !== false).map(({name}) => name) : args.get(null) ); - await build(buildDir, extDir, manifestUtil, variantNames, manifestPath, dryRun, dryRunBuildZip); + await build(buildDir, extDir, manifestUtil, variantNames, manifestPath, dryRun, dryRunBuildZip, yomitanVersion); } finally { // Restore manifest const manifestName = (!args.get('default') && args.get('manifest') !== null) ? args.get('manifest') : null; const restoreManifest = manifestUtil.getManifest(manifestName); process.stdout.write('Restoring manifest...\n'); if (!dryRun) { - fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(restoreManifest)); + fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(restoreManifest).replace('$YOMITAN_VERSION', yomitanVersion)); } } } diff --git a/dev/data/manifest-variants.json b/dev/data/manifest-variants.json index 304a3a0e..26d91d26 100644 --- a/dev/data/manifest-variants.json +++ b/dev/data/manifest-variants.json @@ -2,7 +2,7 @@ "manifest": { "manifest_version": 3, "name": "Yomitan", - "version": "23.4.7.0", + "version": "$YOMITAN_VERSION", "description": "Japanese dictionary with Anki integration", "author": "TheMoeWay", "icons": { diff --git a/ext/manifest.json b/ext/manifest.json deleted file mode 100644 index 018a4a0b..00000000 --- a/ext/manifest.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "manifest_version": 3, - "name": "Yomitan", - "version": "23.4.7.0", - "description": "Japanese dictionary with Anki integration", - "author": "TheMoeWay", - "icons": { - "16": "images/icon16.png", - "19": "images/icon19.png", - "32": "images/icon32.png", - "38": "images/icon38.png", - "48": "images/icon48.png", - "64": "images/icon64.png", - "128": "images/icon128.png" - }, - "action": { - "default_icon": { - "16": "images/icon16.png", - "19": "images/icon19.png", - "32": "images/icon32.png", - "38": "images/icon38.png", - "48": "images/icon48.png", - "64": "images/icon64.png", - "128": "images/icon128.png" - }, - "default_title": "Yomitan", - "default_popup": "action-popup.html" - }, - "background": { - "service_worker": "sw.js" - }, - "content_scripts": [ - { - "run_at": "document_idle", - "matches": [ - "http://*/*", - "https://*/*", - "file://*/*" - ], - "match_about_blank": true, - "all_frames": true, - "js": [ - "js/core.js", - "js/yomichan.js", - "js/app/frontend.js", - "js/app/popup.js", - "js/app/popup-factory.js", - "js/app/popup-proxy.js", - "js/app/popup-window.js", - "js/app/theme-controller.js", - "js/comm/api.js", - "js/comm/cross-frame-api.js", - "js/comm/frame-ancestry-handler.js", - "js/comm/frame-client.js", - "js/comm/frame-offset-forwarder.js", - "js/data/sandbox/string-util.js", - "js/dom/dom-text-scanner.js", - "js/dom/document-util.js", - "js/dom/text-source-element.js", - "js/dom/text-source-range.js", - "js/input/hotkey-handler.js", - "js/language/text-scanner.js", - "js/script/dynamic-loader.js", - "js/app/content-script-main.js" - ] - } - ], - "minimum_chrome_version": "96.0.0.0", - "options_ui": { - "page": "settings.html", - "open_in_tab": true - }, - "sandbox": { - "pages": [ - "template-renderer.html" - ] - }, - "permissions": [ - "storage", - "clipboardWrite", - "unlimitedStorage", - "webRequest", - "declarativeNetRequest", - "scripting" - ], - "optional_permissions": [ - "clipboardRead", - "nativeMessaging" - ], - "host_permissions": [ - "" - ], - "commands": { - "toggleTextScanning": { - "suggested_key": { - "default": "Alt+Delete" - }, - "description": "Toggle text scanning on/off" - }, - "openInfoPage": { - "description": "Open the info page" - }, - "openSettingsPage": { - "description": "Open the settings page" - }, - "openSearchPage": { - "suggested_key": { - "default": "Alt+Insert" - }, - "description": "Open the search page" - }, - "openPopupWindow": { - "description": "Open the popup window" - } - }, - "web_accessible_resources": [ - { - "resources": [ - "popup.html", - "template-renderer.html" - ], - "matches": [ - "" - ] - } - ], - "content_security_policy": { - "extension_pages": "default-src 'self'; img-src blob: 'self'; style-src 'self' 'unsafe-inline'; media-src *; connect-src *", - "sandbox": "sandbox allow-scripts; default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'unsafe-inline'" - } -} -- cgit v1.2.3 From 3c413737ba9ca0ea894dd1e4494bd3efff333c1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 23 Sep 2023 14:26:45 +0000 Subject: Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/broken-links.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/create-prerelease-on-tag.yml | 2 +- .github/workflows/playwright.yml | 4 ++-- .github/workflows/publish-firefox-development.yml | 2 +- .github/workflows/scorecard.yml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml index bb2028c6..45043e79 100644 --- a/.github/workflows/broken-links.yml +++ b/.github/workflows/broken-links.yml @@ -16,7 +16,7 @@ jobs: link-checker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: lycheeverse/lychee-action@ec3ed119d4f44ad2673a7232460dc7dff59d2421 with: fail: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b81df2f..4a767541 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup node uses: actions/setup-node@v3 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a06541ca..bac2d4b8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/create-prerelease-on-tag.yml b/.github/workflows/create-prerelease-on-tag.yml index 0999c5ec..31c39bf1 100644 --- a/.github/workflows/create-prerelease-on-tag.yml +++ b/.github/workflows/create-prerelease-on-tag.yml @@ -13,7 +13,7 @@ jobs: actions: write contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup node uses: actions/setup-node@v3 diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 8efc184a..f84922d2 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -13,7 +13,7 @@ jobs: - name: Remove all fonts run: rm -rf /usr/share/fonts - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install CJK fonts uses: awalsh128/cache-apt-pkgs-action@1850ee53f6e706525805321a3f2f863dcf73c962 # v1.3.0 @@ -45,7 +45,7 @@ jobs: run: npx playwright install chromium - name: Grab latest dictionaries from dictionaries branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: themoeway/yomitan # so that this works on forks ref: dictionaries diff --git a/.github/workflows/publish-firefox-development.yml b/.github/workflows/publish-firefox-development.yml index 8d8cd616..d4800f49 100644 --- a/.github/workflows/publish-firefox-development.yml +++ b/.github/workflows/publish-firefox-development.yml @@ -55,7 +55,7 @@ jobs: # update update.json so that all people who have the dev version installed get the new update - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: metadata diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index cb9db177..55807c25 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -29,7 +29,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + uses: actions/checkout@v4 # v3.1.0 with: persist-credentials: false -- cgit v1.2.3 From 881f7ce612d7f5e7eb25bc9d3b90550802644440 Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sat, 23 Sep 2023 23:47:07 +0900 Subject: Remove incorrect checkout version comment in scorecard.yml --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 55807c25..f502e784 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -29,7 +29,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@v4 # v3.1.0 + uses: actions/checkout@v4 with: persist-credentials: false -- cgit v1.2.3 From 81242a3acbea1455d535ddda78224e887a517cb3 Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sat, 23 Sep 2023 23:48:48 +0900 Subject: Remove incorrect version comment in scorecard.yml --- .github/workflows/scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b03b17b4..f79530ac 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -56,7 +56,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@v3 # v3.1.0 + uses: actions/upload-artifact@v3 with: name: SARIF file path: results.sarif -- cgit v1.2.3 From 923bff8e913c02639fbd9d43912d02184785d91d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 23 Sep 2023 14:54:49 +0000 Subject: Bump dawidd6/action-download-artifact from 2.27.0 to 2.28.0 Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 2.27.0 to 2.28.0. - [Release notes](https://github.com/dawidd6/action-download-artifact/releases) - [Commits](https://github.com/dawidd6/action-download-artifact/compare/246dbf436b23d7c49e21a7ab8204ca9ecd1fe615...268677152d06ba59fcec7a7f0b5d961b6ccd7e1e) --- updated-dependencies: - dependency-name: dawidd6/action-download-artifact dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/auto-approve-run.yml | 2 +- .github/workflows/playwright.yml | 2 +- .github/workflows/playwright_comment.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/auto-approve-run.yml b/.github/workflows/auto-approve-run.yml index 45c169ba..7ea82489 100644 --- a/.github/workflows/auto-approve-run.yml +++ b/.github/workflows/auto-approve-run.yml @@ -14,7 +14,7 @@ jobs: if: github.actor == 'djahandarie' steps: - name: Download workflow artifact - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0 + uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} workflow: auto-approve.yml diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index f84922d2..8d4adca8 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -52,7 +52,7 @@ jobs: path: dictionaries - name: Grab latest screenshots from master branch - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # pin@v2 + uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # pin@v2 continue-on-error: true id: master-screenshots with: diff --git a/.github/workflows/playwright_comment.yml b/.github/workflows/playwright_comment.yml index d5a6727b..60b3c693 100644 --- a/.github/workflows/playwright_comment.yml +++ b/.github/workflows/playwright_comment.yml @@ -16,7 +16,7 @@ jobs: github.event.workflow_run.conclusion == 'success' steps: - name: Grab playwright-output from PR run - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # pin@v2 + uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # pin@v2 continue-on-error: true with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -24,7 +24,7 @@ jobs: name: playwright-output - name: Grab master-screenshots-outcome from PR run - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # pin@v2 + uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # pin@v2 continue-on-error: true with: github_token: ${{ secrets.GITHUB_TOKEN }} -- cgit v1.2.3 From 75f8648418b3dabd6bd1a3d2c7c67c1633695bb5 Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 24 Sep 2023 00:10:13 +0900 Subject: Fix bug in prerelease CI workflow --- .github/workflows/create-prerelease-on-tag.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/create-prerelease-on-tag.yml b/.github/workflows/create-prerelease-on-tag.yml index 31c39bf1..0061ed2a 100644 --- a/.github/workflows/create-prerelease-on-tag.yml +++ b/.github/workflows/create-prerelease-on-tag.yml @@ -21,7 +21,7 @@ jobs: node-version-file: ".node-version" - name: Lint - run: npm run-script build -- --yomitan-version ${{ github.ref_name }} + run: npm run-script build -- --all --yomitan-version ${{ github.ref_name }} shell: bash - name: Release -- cgit v1.2.3 From c09ac436952b845d6703de3ebfa2062833979911 Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 24 Sep 2023 00:28:12 +0900 Subject: Fix bug in publish-firefox-development, use correct filepath --- .github/workflows/publish-firefox-development.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/publish-firefox-development.yml b/.github/workflows/publish-firefox-development.yml index 07b2d614..f704e365 100644 --- a/.github/workflows/publish-firefox-development.yml +++ b/.github/workflows/publish-firefox-development.yml @@ -53,15 +53,15 @@ jobs: asset_name: yomitan-firefox-dev.xpi asset_content_type: application/x-xpinstall - # update update.json so that all people who have the dev version installed get the new update + # update updates.json so that all people who have the dev version installed get the new update - uses: actions/checkout@v4 with: ref: metadata - - name: Recreate update.json + - name: Recreate updates.json run: | - cat > update.json << EOF + cat > updates.json << EOF { "addons": { "{2d13e145-294e-4ead-9bce-b4644b203a00}": { -- cgit v1.2.3