Skip to content

Commit bbf9e0d

Browse files
committed
Add GitHub Actions workflow and release setup documentation for CRX builds
1 parent 0669fea commit bbf9e0d

File tree

3 files changed

+234
-0
lines changed

3 files changed

+234
-0
lines changed

.github/RELEASE_SETUP.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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

.github/workflows/release.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Build and Release CRX
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build-and-release:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: "16"
22+
23+
- name: Get version from tag or release
24+
id: get_version
25+
run: |
26+
if [ "${{ github.event_name }}" == "release" ]; then
27+
VERSION="${{ github.event.release.tag_name }}"
28+
else
29+
VERSION="${GITHUB_REF#refs/tags/}"
30+
fi
31+
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
32+
echo "Version: ${VERSION}"
33+
34+
- name: Install crx3 package
35+
run: npm install -g crx3
36+
37+
- name: Create private key file
38+
run: echo "${{ secrets.CRX_PRIVATE_KEY }}" > private-key.pem
39+
40+
- name: Prepare extension files
41+
run: |
42+
mkdir -p build
43+
# Copy all extension files except workflow files, git files, and README
44+
rsync -av --exclude='.git*' --exclude='*.md' --exclude='build' --exclude='*.pem' ./ build/
45+
46+
- name: Build CRX file
47+
run: |
48+
npx crx3 build/GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.crx -p private-key.pem build/
49+
ls -lh build/
50+
51+
- name: Create ZIP archive (for manual installation)
52+
run: |
53+
cd build
54+
zip -r ../GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.zip . -x "*.crx"
55+
cd ..
56+
57+
- name: Generate SHA256 checksums
58+
run: |
59+
sha256sum build/GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.crx > checksums.txt
60+
sha256sum GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.zip >> checksums.txt
61+
cat checksums.txt
62+
63+
- name: Upload CRX to release
64+
uses: softprops/action-gh-release@v1
65+
with:
66+
files: |
67+
build/GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.crx
68+
GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.zip
69+
checksums.txt
70+
tag_name: ${{ steps.get_version.outputs.VERSION }}
71+
body: |
72+
## GoExport Chrome Extension Release ${{ steps.get_version.outputs.VERSION }}
73+
74+
### Installation Instructions
75+
76+
**Option 1: CRX File (Recommended for Chrome 87)**
77+
1. Download `GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.crx`
78+
2. Open Chrome and navigate to `chrome://extensions/`
79+
3. Enable "Developer mode" (top-right toggle)
80+
4. Drag and drop the `.crx` file onto the extensions page
81+
82+
**Option 2: ZIP File (Manual Installation)**
83+
1. Download `GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.zip`
84+
2. Extract the ZIP file to a folder
85+
3. Open Chrome and navigate to `chrome://extensions/`
86+
4. Enable "Developer mode" (top-right toggle)
87+
5. Click "Load unpacked" and select the extracted folder
88+
89+
### What's Included
90+
- **GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.crx**: Packaged Chrome extension (Manifest V2)
91+
- **GoExport-Extension-${{ steps.get_version.outputs.VERSION }}.zip**: Unpacked extension files for manual installation
92+
- **checksums.txt**: SHA256 checksums for verification
93+
94+
### Requirements
95+
- Chrome 87 or compatible Chromium-based browser
96+
- GoExport desktop application installed with protocol handler configured
97+
98+
### Compatibility
99+
This is a Manifest V2 extension designed for legacy Chrome versions (v87). It integrates FlashThemes.net with the GoExport desktop application.
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Private keys for CRX signing
2+
*.pem
3+
4+
# Build artifacts
5+
build/
6+
*.crx
7+
*.zip
8+
9+
# OS files
10+
.DS_Store
11+
Thumbs.db
12+
13+
# Editor files
14+
.vscode/
15+
.idea/
16+
*.swp
17+
*.swo
18+
*~

0 commit comments

Comments
 (0)