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 }} diff --git a/.gitignore b/.gitignore index 8870ff4..38760ce 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ dist/ *.tsbuildinfo .opencli/ .mcp.json +*.log # Extensions & Secrets *.pem