From d7bf5d6e04f9b3570066b814cbbde6e6133dc8d0 Mon Sep 17 00:00:00 2001 From: jackwener Date: Fri, 20 Mar 2026 10:51:27 +0800 Subject: [PATCH 1/2] ci: add github action for building extension zip and crx --- .github/workflows/build-extension.yml | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/build-extension.yml diff --git a/.github/workflows/build-extension.yml b/.github/workflows/build-extension.yml new file mode 100644 index 0000000..301a71e --- /dev/null +++ b/.github/workflows/build-extension.yml @@ -0,0 +1,62 @@ +name: Build Chrome Extension + +on: + push: + branches: [ "main" ] + tags: [ "v*.*.*" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Create Extension ZIP + run: | + cd extension + zip -r ../opencli-extension.zip . + + - name: Create Extension CRX + run: | + npm install -g crx3 + if [ -n "${{ secrets.CRX_PRIVATE_KEY }}" ]; then + echo "Found CRX_PRIVATE_KEY, signing extension..." + echo "${{ secrets.CRX_PRIVATE_KEY }}" > crx-key.pem + crx3 pack extension -o opencli-extension.crx -p crx-key.pem + rm crx-key.pem + else + echo "No CRX_PRIVATE_KEY configured. Generating CRX with a temporary random key..." + crx3 pack extension -o opencli-extension.crx + fi + + - name: Upload Artifacts (Action Run) + uses: actions/upload-artifact@v4 + with: + name: opencli-extension-build + path: | + opencli-extension.zip + opencli-extension.crx + retention-days: 7 + + - name: Attach to GitHub Release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + with: + files: | + opencli-extension.zip + opencli-extension.crx + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 691f835bdf67e1299f31adcafd5ea9800305f331 Mon Sep 17 00:00:00 2001 From: jackwener Date: Fri, 20 Mar 2026 10:54:03 +0800 Subject: [PATCH 2/2] chore: ignore extension build artifacts and pem keys --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 684e4f9..38760ce 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,8 @@ dist/ .opencli/ .mcp.json *.log + +# Extensions & Secrets +*.pem +*.crx +*.zip