From 3be868365d1e76cc7a79520c8727b98d80a6bdb7 Mon Sep 17 00:00:00 2001 From: Marcus Date: Fri, 22 Nov 2024 12:01:09 -0800 Subject: [PATCH 1/4] install chrome-webstore-upload-cli --- package-lock.json | 135 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 136 insertions(+) diff --git a/package-lock.json b/package-lock.json index 0da1c7a31..e019c368b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,6 +6,7 @@ "": { "license": "GPL-3.0", "devDependencies": { + "chrome-webstore-upload-cli": "^3.3.1", "dotenv": "^16.4.5", "eslint": "^7.32.0", "jsonwebtoken": "^9.0.2", @@ -1198,6 +1199,42 @@ "node": ">=12.13.0" } }, + "node_modules/chrome-webstore-upload": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/chrome-webstore-upload/-/chrome-webstore-upload-3.1.4.tgz", + "integrity": "sha512-xOfGsFeVv+0ZxZylMoCdMlXVvXY4cvzR8GEDvnuRc6uWz4YR/3RNK6wUb5s2Wulk8SDhNQ259JWP8c8HNL93ng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/fregante" + } + }, + "node_modules/chrome-webstore-upload-cli": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/chrome-webstore-upload-cli/-/chrome-webstore-upload-cli-3.3.1.tgz", + "integrity": "sha512-9QHK6/yQAPttUK68Vzrj93nQUWKo0UMYJwG2KTkcUQke31QuzsYB1XGqmNd+XrQj7rxDTyGZa1QJznIgIXkmRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chrome-webstore-upload": "^3.1.0", + "junk": "^4.0.1", + "meow": "^12.1.1", + "recursive-readdir": "^2.2.3", + "yazl": "^2.5.1" + }, + "bin": { + "chrome-webstore-upload": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/fregante" + } + }, "node_modules/cli-boxes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", @@ -3007,6 +3044,19 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/junk": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/junk/-/junk-4.0.1.tgz", + "integrity": "sha512-Qush0uP+G8ZScpGMZvHUiRfI0YBWuB3gVBYlI0v0vvOJt5FLicco+IkP0a50LqTTQhmts/m6tP5SWE+USyIvcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -3248,6 +3298,19 @@ "node": ">=6" } }, + "node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -3975,6 +4038,19 @@ "node": ">= 12.13.0" } }, + "node_modules/recursive-readdir": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz", + "integrity": "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", @@ -5146,6 +5222,16 @@ "fd-slicer": "~1.1.0" } }, + "node_modules/yazl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", + "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", @@ -6044,6 +6130,25 @@ "lighthouse-logger": "^2.0.1" } }, + "chrome-webstore-upload": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/chrome-webstore-upload/-/chrome-webstore-upload-3.1.4.tgz", + "integrity": "sha512-xOfGsFeVv+0ZxZylMoCdMlXVvXY4cvzR8GEDvnuRc6uWz4YR/3RNK6wUb5s2Wulk8SDhNQ259JWP8c8HNL93ng==", + "dev": true + }, + "chrome-webstore-upload-cli": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/chrome-webstore-upload-cli/-/chrome-webstore-upload-cli-3.3.1.tgz", + "integrity": "sha512-9QHK6/yQAPttUK68Vzrj93nQUWKo0UMYJwG2KTkcUQke31QuzsYB1XGqmNd+XrQj7rxDTyGZa1QJznIgIXkmRw==", + "dev": true, + "requires": { + "chrome-webstore-upload": "^3.1.0", + "junk": "^4.0.1", + "meow": "^12.1.1", + "recursive-readdir": "^2.2.3", + "yazl": "^2.5.1" + } + }, "cli-boxes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", @@ -7384,6 +7489,12 @@ } } }, + "junk": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/junk/-/junk-4.0.1.tgz", + "integrity": "sha512-Qush0uP+G8ZScpGMZvHUiRfI0YBWuB3gVBYlI0v0vvOJt5FLicco+IkP0a50LqTTQhmts/m6tP5SWE+USyIvcQ==", + "dev": true + }, "jwa": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", @@ -7593,6 +7704,12 @@ } } }, + "meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true + }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -8125,6 +8242,15 @@ "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", "dev": true }, + "recursive-readdir": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.3.tgz", + "integrity": "sha512-8HrF5ZsXk5FAH9dgsx3BlUer73nIhuj+9OrQwEbLTPOBzGkL1lsFCR01am+v+0m2Cmbs1nP12hLDl5FA7EszKA==", + "dev": true, + "requires": { + "minimatch": "^3.0.5" + } + }, "regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", @@ -8970,6 +9096,15 @@ "fd-slicer": "~1.1.0" } }, + "yazl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", + "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3" + } + }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index cb605e3c7..394f85c88 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "sign": "web-ext sign" }, "devDependencies": { + "chrome-webstore-upload-cli": "^3.3.1", "dotenv": "^16.4.5", "eslint": "^7.32.0", "jsonwebtoken": "^9.0.2", From 11b86658f7a74d2cdad85754d60e09bbc4c5b2e3 Mon Sep 17 00:00:00 2001 From: Marcus Date: Fri, 22 Nov 2024 12:02:41 -0800 Subject: [PATCH 2/4] Update release/publish actions --- ...yml => generate-release-after-signing.yml} | 19 ++++++++++--------- .../{release.yml => generate-release.yml} | 19 ++++++++++--------- ...lease-metadata.yml => publish-release.yml} | 17 +++++++++++++---- 3 files changed, 33 insertions(+), 22 deletions(-) rename .github/workflows/{release-after-signing.yml => generate-release-after-signing.yml} (82%) rename .github/workflows/{release.yml => generate-release.yml} (82%) rename .github/workflows/{update-release-metadata.yml => publish-release.yml} (69%) diff --git a/.github/workflows/release-after-signing.yml b/.github/workflows/generate-release-after-signing.yml similarity index 82% rename from .github/workflows/release-after-signing.yml rename to .github/workflows/generate-release-after-signing.yml index fc95f4e74..e2a32a647 100644 --- a/.github/workflows/release-after-signing.yml +++ b/.github/workflows/generate-release-after-signing.yml @@ -43,15 +43,16 @@ jobs: } return version; - # - name: Chrome — Build - # run: npm run build - # - name: Chrome — Upload and Publish - # run: npx chrome-webstore-upload --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip - # env: - # EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} - # CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} - # CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} - # REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} + - name: Chrome — Build + run: npm run build + - name: Chrome — Upload + run: npx chrome-webstore-upload upload --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip + continue-on-error: true + env: + EXTENSION_ID: ${{ secrets.CWS_EXTENSION_ID }} + CLIENT_ID: ${{ secrets.CWS_CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CWS_CLIENT_SECRET }} + REFRESH_TOKEN: ${{ secrets.CWS_REFRESH_TOKEN }} - name: Create Github release draft uses: softprops/action-gh-release@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/generate-release.yml similarity index 82% rename from .github/workflows/release.yml rename to .github/workflows/generate-release.yml index 6ade1e14b..8743f5de7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/generate-release.yml @@ -47,15 +47,16 @@ jobs: ### NOTE: This workflow may time out here while waiting for Mozilla review. ### If this occurs, run the "Generate Release (after signing)" action once it is complete. - # - name: Chrome — Build - # run: npm run build - # - name: Chrome — Upload and Publish - # run: npx chrome-webstore-upload --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip - # env: - # EXTENSION_ID: ${{ secrets.CHROME_EXTENSION_ID }} - # CLIENT_ID: ${{ secrets.CHROME_CLIENT_ID }} - # CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }} - # REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }} + - name: Chrome — Build + run: npm run build + - name: Chrome — Upload + run: npx chrome-webstore-upload upload --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip + continue-on-error: true + env: + EXTENSION_ID: ${{ secrets.CWS_EXTENSION_ID }} + CLIENT_ID: ${{ secrets.CWS_CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CWS_CLIENT_SECRET }} + REFRESH_TOKEN: ${{ secrets.CWS_REFRESH_TOKEN }} - name: Create Github release draft uses: softprops/action-gh-release@v2 diff --git a/.github/workflows/update-release-metadata.yml b/.github/workflows/publish-release.yml similarity index 69% rename from .github/workflows/update-release-metadata.yml rename to .github/workflows/publish-release.yml index a8131eb5c..b764a635f 100644 --- a/.github/workflows/update-release-metadata.yml +++ b/.github/workflows/publish-release.yml @@ -1,4 +1,4 @@ -name: Update Release Metadata +name: Publish Release on: workflow_dispatch: @@ -9,8 +9,8 @@ on: required: false jobs: - create-update-pr: - name: Create update PR + publish-releases: + name: Publish Releases runs-on: ubuntu-latest steps: - name: Checkout @@ -22,10 +22,19 @@ jobs: node-version: lts/* cache: npm + - name: Chrome — Publish Release + run: npx chrome-webstore-upload publish + continue-on-error: true + env: + EXTENSION_ID: ${{ secrets.CWS_EXTENSION_ID }} + CLIENT_ID: ${{ secrets.CWS_CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CWS_CLIENT_SECRET }} + REFRESH_TOKEN: ${{ secrets.CWS_REFRESH_TOKEN }} + - name: Update release metadata run: node dev/update_release_metadata.mjs ${{ inputs.newVersion || '' }} - - name: Create pull request + - name: Create release pull request uses: peter-evans/create-pull-request@v7 with: title: Update release metadata From 81528db283f97b9d215ecba283aa8e9dc27d36af Mon Sep 17 00:00:00 2001 From: Marcus Date: Sun, 1 Dec 2024 15:03:59 -0800 Subject: [PATCH 3/4] replace npx with package scripts --- .github/workflows/generate-release-after-signing.yml | 2 +- .github/workflows/generate-release.yml | 2 +- .github/workflows/publish-release.yml | 2 +- package.json | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate-release-after-signing.yml b/.github/workflows/generate-release-after-signing.yml index a7f0d0a80..dc80b3554 100644 --- a/.github/workflows/generate-release-after-signing.yml +++ b/.github/workflows/generate-release-after-signing.yml @@ -49,7 +49,7 @@ jobs: - name: Chrome — Build run: npm run build - name: Chrome — Upload - run: npx chrome-webstore-upload upload --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip + run: npm run chrome-upload -- --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip continue-on-error: true env: EXTENSION_ID: ${{ secrets.CWS_EXTENSION_ID }} diff --git a/.github/workflows/generate-release.yml b/.github/workflows/generate-release.yml index 8743f5de7..af025cfd3 100644 --- a/.github/workflows/generate-release.yml +++ b/.github/workflows/generate-release.yml @@ -50,7 +50,7 @@ jobs: - name: Chrome — Build run: npm run build - name: Chrome — Upload - run: npx chrome-webstore-upload upload --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip + run: npm run chrome-upload -- --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip continue-on-error: true env: EXTENSION_ID: ${{ secrets.CWS_EXTENSION_ID }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index b764a635f..e2dada32b 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -23,7 +23,7 @@ jobs: cache: npm - name: Chrome — Publish Release - run: npx chrome-webstore-upload publish + run: npm run chrome-publish continue-on-error: true env: EXTENSION_ID: ${{ secrets.CWS_EXTENSION_ID }} diff --git a/package.json b/package.json index 394f85c88..0d15ba073 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "test": "eslint .", "lint": "web-ext lint", "build": "web-ext build", - "sign": "web-ext sign" + "sign": "web-ext sign", + "chrome-upload": "chrome-webstore-upload upload", + "chrome-publish": "chrome-webstore-upload publish" }, "devDependencies": { "chrome-webstore-upload-cli": "^3.3.1", From 562273bc898f53289ba9d95ed3ed2abc06d357ed Mon Sep 17 00:00:00 2001 From: Marcus Date: Sun, 1 Dec 2024 15:08:49 -0800 Subject: [PATCH 4/4] add clarifying comments --- .github/workflows/generate-release-after-signing.yml | 3 +++ .github/workflows/generate-release.yml | 3 +++ .github/workflows/publish-release.yml | 2 ++ 3 files changed, 8 insertions(+) diff --git a/.github/workflows/generate-release-after-signing.yml b/.github/workflows/generate-release-after-signing.yml index dc80b3554..d235ebe5a 100644 --- a/.github/workflows/generate-release-after-signing.yml +++ b/.github/workflows/generate-release-after-signing.yml @@ -48,6 +48,9 @@ jobs: - name: Chrome — Build run: npm run build + + # uploads to Chrome Web Store servers, but does not publish; + # see https://github.com/fregante/chrome-webstore-upload-cli#usage - name: Chrome — Upload run: npm run chrome-upload -- --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip continue-on-error: true diff --git a/.github/workflows/generate-release.yml b/.github/workflows/generate-release.yml index af025cfd3..86ef855c5 100644 --- a/.github/workflows/generate-release.yml +++ b/.github/workflows/generate-release.yml @@ -49,6 +49,9 @@ jobs: - name: Chrome — Build run: npm run build + + # uploads to Chrome Web Store servers, but does not publish; + # see https://github.com/fregante/chrome-webstore-upload-cli#usage - name: Chrome — Upload run: npm run chrome-upload -- --source=web-ext-artifacts/new_xkit-${{ steps.get-version.outputs.result }}.zip continue-on-error: true diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index e2dada32b..2c0fc5128 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -22,6 +22,8 @@ jobs: node-version: lts/* cache: npm + # publishes the last uploaded version on Chrome Web Store servers; + # see https://github.com/fregante/chrome-webstore-upload-cli#usage - name: Chrome — Publish Release run: npm run chrome-publish continue-on-error: true