Equicord/.github/workflows/buildBranches.yml
thororen1234 8f5b2cc5d0
act
2026-05-07 09:33:54 -04:00

122 lines
3.9 KiB
YAML

name: Build Branches
on:
push:
branches:
- "**"
- "!pr-**"
workflow_dispatch:
inputs:
branch:
type: choice
description: "Branch to build and upload"
options:
- main
- dev
- translation
default: "dev"
env:
FORCE_COLOR: true
GITHUB_TOKEN: ${{ secrets.ETOKEN }}
REPO: Equicord/Equibuilds
USERNAME: GitHub-Actions
permissions:
contents: write
jobs:
Build:
name: Build Equicord
runs-on: ubuntu-latest
if: github.repository == 'Equicord/Equicord'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}
- uses: pnpm/action-setup@v3
if: github.ref_name != 'bun'
- name: Use Node.js 24
if: github.ref_name != 'bun'
uses: actions/setup-node@v4
with:
node-version: 24
cache: "pnpm"
- name: Install dependencies
if: github.ref_name != 'bun'
run: pnpm install --frozen-lockfile
- name: Build web
if: github.ref_name != 'bun'
run: pnpm buildWebStandalone
- name: Build
if: github.ref_name != 'bun'
run: pnpm buildStandalone
- name: Generate plugin lists
if: github.ref_name != 'bun'
run: |
pnpm generatePluginJson dist/plugins.json
pnpm generateEquicordPluginJson dist/equicordplugins.json
pnpm generateVencordPluginJson dist/vencordplugins.json
pnpm generateDevsList dist/devs.json
- uses: oven-sh/setup-bun@v2
if: github.ref_name == 'bun'
with:
bun-version: latest
- name: Install dependencies
if: github.ref_name == 'bun'
run: bun install
- name: Build web
if: github.ref_name == 'bun'
run: bun run buildWebStandalone
- name: Build
if: github.ref_name == 'bun'
run: bun run buildStandalone
- name: Generate plugin lists
if: github.ref_name == 'bun'
run: |
bun run generatePluginJson dist/plugins.json
bun run generateEquicordPluginJson dist/equicordplugins.json
bun run generateVencordPluginJson dist/vencordplugins.json
bun run generateDevsList dist/devs.json
- name: Upload to Equibuilds repo
if: ${{ !vars.ACT }}
run: |
BRANCH="${{ github.event.inputs.branch || github.ref_name }}"
COMMIT_SHA=$(git rev-parse --short HEAD)
git config --global user.name "GitHub-Actions"
git config --global user.email actions@github.com
git clone https://$USERNAME:$GITHUB_TOKEN@github.com/$REPO.git equibuilds
cd equibuilds
if git ls-remote --exit-code --heads origin "$BRANCH" > /dev/null 2>&1; then
git checkout "$BRANCH"
else
git checkout --orphan "$BRANCH"
fi
cp -r ../dist/* .
find . -size 0 -delete
mkdir -p userscript
mv Equicord.user.* userscript/
mv desktop.asar desktop/
mv equibop.asar equibop/
mv extension-*.zip browser/
git add -A
git commit -m "Builds for https://github.com/$GITHUB_REPOSITORY/commit/$COMMIT_SHA"
git push --force https://$USERNAME:$GITHUB_TOKEN@github.com/$REPO.git "$BRANCH"