Skip to content

Commit

Permalink
Update the build process, including a step to auto-upload to the Chro…
Browse files Browse the repository at this point in the history
…me Web Store and new README directions.
  • Loading branch information
SirStendec committed Oct 19, 2024
1 parent 306ddbc commit 7c986e7
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 14 deletions.
46 changes: 44 additions & 2 deletions .github/workflows/build-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ jobs:
run: |
cd client
pnpm install
FFZ_EXTENSION=true pnpm build
pnpm build:ext
cd ..
- name: Build the Add-Ons Repository
run: |
cd addons
pnpm install
FFZ_EXTENSION=true pnpm build
pnpm build:ext
cd ..
- name: Copy Build Output
Expand Down Expand Up @@ -161,3 +161,45 @@ jobs:
Please check the logs for details.
[Download Source](<${{ steps.source-upload-step.outputs.artifact-url }}>)
publish-nightly:
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.result == 'success' }}
steps:
- name: Checkout Extension Repo
uses: actions/checkout@v4

- name: Download Nightly Artifact
uses: actions/download-artifact@v4
with:
name: nightly
path: dist

- name: Publish to Chrome Web Store
uses: mnao305/chrome-extension-upload@v5.0.0
with:
glob: true
file-path: dist/frankerfacez-nightly-*.zip
extension-id: jgnjpfcdneiofkjkidlokfipfaignogj
client-id: ${{ secrets.GOOGLE_CLIENT_ID }}
client-secret: ${{ secrets.GOOGLE_CLIENT_SECRET }}
refresh-token: ${{ secrets.GOOGLE_REFRESH_TOKEN }}

- name: Report Success
if: success()
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
embed-color: 3066993
embed-title: ✅ Chrome Nightly Upload Succeeded
embed-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

- name: Report Failure
if: failure()
uses: tsickert/discord-webhook@v6.0.0
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
embed-color: 15158332
embed-title: ❌ Chrome Nightly Upload Failed
embed-url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
75 changes: 63 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,69 @@ Requirements
* git


How to Build
============
How to Build: Source Archive (Firefox Staff: Use This!)
=======================================================

These instructions assume you're starting with a prepared archive of the
relevant source material. You can find such an archive by grabbing the
source artifact from a run of our build process on GitHub. Additionally,
we submit copies of the source artifact when uploading to Firefox due
to Firefox's approval requirements.

1. Ensure you have the requirements installed on your machine.
2. Ensure you're working with a clean copy of the source.
If you are working with a source archive, you should already have the
relevant files downloaded into the `client` and `addons` folders. If
you don't have those, run the following `git` commands to download the
latest code from those repositories:
2. Run this command to load the cached environmental variables with
version info:
```bash
source ffz_env
```
3. Build the main client.
```bash
cd client
pnpm install
pnpm build:ext
cd ..
```
4. Build the add-ons.
```bash
cd addons
pnpm install
pnpm build:ext
cd ..
```
5. Ensure you don't have a `dist` folder. Delete it if you do with:
```bash
rm -rf dist
```
6. Copy the build output from steps 5 and 6 into the `dist` folder:
```bash
chmod +x scripts/copy-output.sh
./scripts/copy-output.sh
```
7. Update the version in the manifest.
```bash
node scripts/update-manifest.js
```
8. Find the unpacked extension in the `dist` folder.
That's it. You're done! You can now zip the extension, if you need to, or
do anything else.
How to Build: Complete From Scratch (Firefox Staff: You don't need this!)
=========================================================================

These instructions assume you're working from a clean checkout of the
Extension repository itself, without any pre-downloaded source.
1. Ensure you have the requirements installed on your machine.
2. Run the following `git` commands to download the
latest source code from FrankerFaceZ's repositories:
```bash
git clone https://github.com/FrankerFaceZ/FrankerFaceZ.git client
git clone https://github.com/FrankerFaceZ/Add-Ons.git addons
```
3. If you had to download the code via git clone, run these commands to
calculate the correct version:
3. Run these commands to calculate the correct version information based
on the state of the git repositories:
```bash
chmod +x scripts/calculate-version.sh
./scripts/calculate-version.sh
Expand All @@ -43,14 +92,14 @@ How to Build
```bash
cd client
pnpm install
FFZ_EXTENSION=true pnpm build
pnpm build:ext
cd ..
```
6. Build the add-ons.
```bash
cd addons
pnpm install
FFZ_EXTENSION=true pnpm build
pnpm build:ext
cd ..
```
7. Ensure you don't have a `dist` folder. Delete it if you do with:
Expand All @@ -67,4 +116,6 @@ How to Build
node scripts/update-manifest.js
```
10. Find the unpacked extension in the `dist` folder.
11. Optionally, zip the contents of the `dist` as suits your needs.
That's it. You're done! You can now zip the extension, if you need to, or
do anything else.
17 changes: 17 additions & 0 deletions scripts/calculate-version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
#!/bin/bash

# Function to check if a directory is a valid git repository
check_git_repo() {
local dir="$1"
if [ ! -d "$dir" ]; then
echo "Error: The directory '$dir' does not exist. Please follow the instructions in README to set up the working sources."
exit 1
fi
if ! git -C "$dir" rev-parse --is-inside-work-tree > /dev/null 2>&1; then
echo "The directory '$dir' does not contain a valid git repository. You likely didn't need to run this command."
exit 1
fi
}

# Check to make sure we have git repos.
check_git_repo "client"
check_git_repo "addons"

# Get the version of the main client.
cd client
VERSION=$(node -p "require('./package.json').version")
Expand Down

0 comments on commit 7c986e7

Please sign in to comment.