|
| 1 | +# GitHub Actions Setup for CRX Releases |
| 2 | + |
| 3 | +This document explains how to set up the GitHub Actions workflow to automatically build and release CRX files for the GoExport Chrome Extension. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +Before the workflow can run successfully, you need to generate a private key and add it to your GitHub repository secrets. |
| 8 | + |
| 9 | +## Step 1: Generate a Private Key |
| 10 | + |
| 11 | +You need to generate a private RSA key that will be used to sign the CRX file. This ensures your extension has a consistent extension ID. |
| 12 | + |
| 13 | +### On Linux/macOS: |
| 14 | + |
| 15 | +```bash |
| 16 | +openssl genrsa 2048 | openssl pkcs8 -topk8 -nocrypt -out private-key.pem |
| 17 | +``` |
| 18 | + |
| 19 | +### On Windows (PowerShell): |
| 20 | + |
| 21 | +If you have OpenSSL installed: |
| 22 | + |
| 23 | +```powershell |
| 24 | +openssl genrsa 2048 | openssl pkcs8 -topk8 -nocrypt -out private-key.pem |
| 25 | +``` |
| 26 | + |
| 27 | +If you don't have OpenSSL, you can: |
| 28 | + |
| 29 | +1. Install via Chocolatey: `choco install openssl` |
| 30 | +2. Or use Git Bash (if Git is installed): Open Git Bash and run the Linux command above |
| 31 | +3. Or use WSL (Windows Subsystem for Linux) |
| 32 | + |
| 33 | +## Step 2: Add Private Key to GitHub Secrets |
| 34 | + |
| 35 | +1. Open your private key file (`private-key.pem`) in a text editor |
| 36 | +2. Copy the entire contents (including the `-----BEGIN PRIVATE KEY-----` and `-----END PRIVATE KEY-----` lines) |
| 37 | +3. Go to your GitHub repository |
| 38 | +4. Navigate to **Settings** → **Secrets and variables** → **Actions** |
| 39 | +5. Click **New repository secret** |
| 40 | +6. Name: `CRX_PRIVATE_KEY` |
| 41 | +7. Value: Paste the entire contents of your private key file |
| 42 | +8. Click **Add secret** |
| 43 | + |
| 44 | +**IMPORTANT:** |
| 45 | + |
| 46 | +- Keep your `private-key.pem` file secure and do NOT commit it to your repository |
| 47 | +- Add `*.pem` to your `.gitignore` file to prevent accidental commits |
| 48 | +- Store a backup of this key file securely - you'll need the same key for future releases to maintain the same extension ID |
| 49 | + |
| 50 | +## Step 3: Create a Release |
| 51 | + |
| 52 | +The workflow will automatically trigger when you: |
| 53 | + |
| 54 | +### Option A: Push a Tag |
| 55 | + |
| 56 | +```bash |
| 57 | +git tag v1.0.0 |
| 58 | +git push origin v1.0.0 |
| 59 | +``` |
| 60 | + |
| 61 | +### Option B: Create a Release via GitHub UI |
| 62 | + |
| 63 | +1. Go to your repository on GitHub |
| 64 | +2. Click **Releases** → **Draft a new release** |
| 65 | +3. Click **Choose a tag** and create a new tag (e.g., `v1.0.0`) |
| 66 | +4. Fill in the release title and description |
| 67 | +5. Click **Publish release** |
| 68 | + |
| 69 | +## Workflow Details |
| 70 | + |
| 71 | +The workflow will: |
| 72 | + |
| 73 | +1. Checkout your code |
| 74 | +2. Install the `crx3` Node.js package for building CRX files |
| 75 | +3. Use your private key to sign the extension |
| 76 | +4. Build the CRX file compatible with Chrome 87 |
| 77 | +5. Create a ZIP archive for manual installation |
| 78 | +6. Generate SHA256 checksums for verification |
| 79 | +7. Upload all files to the GitHub release |
| 80 | + |
| 81 | +## What Gets Released |
| 82 | + |
| 83 | +Each release will include: |
| 84 | + |
| 85 | +- **GoExport-Extension-vX.X.X.crx**: The packaged extension file |
| 86 | +- **GoExport-Extension-vX.X.X.zip**: A ZIP archive for manual "Load unpacked" installation |
| 87 | +- **checksums.txt**: SHA256 checksums for file verification |
| 88 | + |
| 89 | +## Chrome 87 Compatibility |
| 90 | + |
| 91 | +The CRX file is built using the CRX3 format, which is compatible with Chrome 87 and newer versions. Since this is a Manifest V2 extension, it will work with older Chrome versions that still support Manifest V2. |
| 92 | + |
| 93 | +## Troubleshooting |
| 94 | + |
| 95 | +### Error: "secrets.CRX_PRIVATE_KEY is empty" |
| 96 | + |
| 97 | +- Make sure you've added the `CRX_PRIVATE_KEY` secret to your repository as described in Step 2 |
| 98 | + |
| 99 | +### Error: "Invalid private key format" |
| 100 | + |
| 101 | +- Ensure you copied the entire private key including the BEGIN and END lines |
| 102 | +- Make sure there are no extra spaces or line breaks |
| 103 | + |
| 104 | +### CRX file won't install |
| 105 | + |
| 106 | +- Make sure you're using Chrome 87 or later |
| 107 | +- Enable "Developer mode" in `chrome://extensions/` |
| 108 | +- Try using the ZIP file with "Load unpacked" instead |
| 109 | + |
| 110 | +## Security Notes |
| 111 | + |
| 112 | +- Never commit your private key file to the repository |
| 113 | +- Never share your private key publicly |
| 114 | +- The private key in GitHub Secrets is encrypted and only accessible to workflow runs |
| 115 | +- GitHub Actions will automatically clean up temporary files (including the private key) after the workflow completes |
0 commit comments