build-trigger #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Extension | |
on: | |
repository_dispatch: | |
types: [build-trigger] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Extension Repo | |
uses: actions/checkout@v3 | |
- name: Uses PNPM | |
uses: pnpm/action-setup@v2.0.1 | |
with: | |
version: 6.20.4 | |
- name: Uses Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
cache: 'pnpm' | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Clone FrankerFaceZ Repository | |
run: | | |
git clone https://github.com/FrankerFaceZ/FrankerFaceZ.git client | |
- name: Clone Add-Ons Repository | |
run: | | |
git clone https://github.com/FrankerFaceZ/Add-Ons.git addons | |
- name: Calculate Version | |
run: | | |
# Get the version of the main client. | |
cd client | |
VERSION=$(node -p "require('./package.json').version") | |
echo "Main Client Version: $VERSION" | |
# Now determine when the version was last modified. | |
LAST_MODIFIED=$(git log -1 --pretty=format:%ct -- package.json) | |
echo "Last Modified: $LAST_MODIFIED" | |
cd .. | |
# Navigate to the Add-Ons next. | |
cd addons | |
# And count the number of commits since the last modified time. | |
BUILD=$(git rev-list --count --since=@$LAST_MODIFIED HEAD) | |
echo "Build Number (add-on commits since last main client update): $BUILD" | |
cd .. | |
# Export FFZ_VERSION and FFZ_BUILD as an environment variable for subsequent steps. | |
echo "FFZ_VERSION=$VERSION" >> $GITHUB_ENV | |
echo "FFZ_BUILD=$BUILD" >> $GITHUB_ENV | |
- name: Build the Main Client | |
run: | | |
cd client | |
pnpm install | |
FFZ_EXTENSION=true pnpm build | |
cd .. | |
- name: Build the Add-Ons Repository | |
run: | | |
cd addons | |
pnpm install | |
FFZ_EXTENSION=true pnpm build | |
cd .. | |
- name: Run Final Build | |
run: pnpm build | |
- name: Package for Firefox | |
run: | | |
echo "TODO: THIS" | |
- name: Package for Chrome | |
run: | | |
echo "TODO: THIS" | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: built | |
path: dist/* |