Rework Actions

This commit is contained in:
thororen1234 2024-11-01 01:02:07 -04:00
parent 7b6c28bd0c
commit 719d90bfdd
11 changed files with 308 additions and 189 deletions

View file

@ -8,6 +8,8 @@ env:
FORCE_COLOR: true
GITHUB_TOKEN: ${{ secrets.ETOKEN }}
permissions: write-all
jobs:
Build:
name: Build Equicord
@ -16,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
- uses: pnpm/action-setup@v3
- name: Use Node.js 20
uses: actions/setup-node@v4
@ -34,7 +36,7 @@ jobs:
run: pnpm buildStandalone
- name: Generate plugin list
run: pnpm generatePluginJson dist/plugins.json dist/plugin-readmes.json
run: pnpm generatePluginJson dist/vencordplugins.json
- name: Generate Equicord plugin list
run: pnpm generateEquicordPluginJson dist/equicordplugins.json
@ -69,26 +71,15 @@ jobs:
- name: Upload Equicord Stable
if: ${{ github.ref_name == 'main' }}
run: |
gh release upload latest --clobber dist/release/*
gh release upload latest --clobber dist/release/*
- name: Upload Equicord Dev
if: ${{ github.ref_name == 'dev' }}
run: |
gh release upload devbuild --clobber dist/release/*
gh release upload devbuild --clobber dist/release/*
- name: Upload Plugins JSON to Equibored repo
if: ${{ github.ref_name == 'main' }}
run: |
git config --global user.name "$USERNAME"
git config --global user.email "78185467+thororen1234@users.noreply.github.com"
git clone https://$USERNAME:$API_TOKEN@github.com/$GH_REPO.git upload
cd upload
rm plugins.json
cp -r ../dist/equicordplugins.json plugins.json
git add -A
git commit -m "Plugins for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
git push --force https://$USERNAME:$API_TOKEN@github.com/$GH_REPO.git
env:
API_TOKEN: ${{ secrets.ETOKEN }}
GH_REPO: Equicord/Equibored
USERNAME: thororen1234
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: "build"
path: "dist/release/*"

View file

@ -1,22 +1,22 @@
name: Sync to Codeberg
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
group: ${{ github.ref }}
cancel-in-progress: true
on:
push:
workflow_dispatch:
schedule:
- cron: "0 */6 * * *"
push:
workflow_dispatch:
schedule:
- cron: "0 */6 * * *"
jobs:
codeberg:
name: Sync Codeberg and Github
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pixta-dev/repository-mirroring-action@674e65a7d483ca28dafaacba0d07351bdcc8bd75 # v1.1.1
with:
target_repo_url: "git@codeberg.org:thororen/Equicord.git"
ssh_private_key: ${{ secrets.CODEBERG }}
codeberg:
name: Sync Codeberg and Github
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pixta-dev/repository-mirroring-action@674e65a7d483ca28dafaacba0d07351bdcc8bd75 # v1.1.1
with:
target_repo_url: "git@codeberg.org:thororen/Equicord.git"
ssh_private_key: ${{ secrets.CODEBERG }}

View file

@ -1,67 +1,67 @@
name: Test Patches
on:
workflow_dispatch:
schedule:
# Every day at midnight
- cron: 0 0 * * *
workflow_dispatch:
schedule:
# Every day at midnight
- cron: 0 0 * * *
jobs:
TestPlugins:
name: Test Patches
runs-on: ubuntu-latest
TestPlugins:
name: Test Patches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: ${{ github.event_name == 'schedule' }}
with:
ref: dev
steps:
- uses: actions/checkout@v4
if: ${{ github.event_name == 'schedule' }}
with:
ref: dev
- uses: actions/checkout@v4
if: ${{ github.event_name == 'workflow_dispatch' }}
- uses: actions/checkout@v4
if: ${{ github.event_name == 'workflow_dispatch' }}
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
- name: Install dependencies
run: |
pnpm install --frozen-lockfile
- name: Install Google Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@82b9ce628cc5595478a9ebadc480958a36457dc2
with:
chrome-version: stable
- name: Install Google Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@82b9ce628cc5595478a9ebadc480958a36457dc2
with:
chrome-version: stable
- name: Build Equicord Reporter Version
run: pnpm buildReporter
- name: Build Equicord Reporter Version
run: pnpm buildReporter
- name: Create Report
timeout-minutes: 10
run: |
export PATH="$PWD/node_modules/.bin:$PATH"
export CHROMIUM_BIN=${{ steps.setup-chrome.outputs.chrome-path }}
- name: Create Report
timeout-minutes: 10
run: |
export PATH="$PWD/node_modules/.bin:$PATH"
export CHROMIUM_BIN=${{ steps.setup-chrome.outputs.chrome-path }}
esbuild scripts/generateReport.ts > dist/report.mjs
node dist/report.mjs >> $GITHUB_STEP_SUMMARY
env:
DISCORD_TOKEN: ${{ secrets.DTOKEN }}
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK }}
esbuild scripts/generateReport.ts > dist/report.mjs
node dist/report.mjs >> $GITHUB_STEP_SUMMARY
env:
DISCORD_TOKEN: ${{ secrets.DTOKEN }}
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK }}
- name: Create Report (Canary)
timeout-minutes: 10
if: success() || failure() # even run if previous one failed
run: |
export PATH="$PWD/node_modules/.bin:$PATH"
export CHROMIUM_BIN=${{ steps.setup-chrome.outputs.chrome-path }}
export USE_CANARY=true
- name: Create Report (Canary)
timeout-minutes: 10
if: success() || failure() # even run if previous one failed
run: |
export PATH="$PWD/node_modules/.bin:$PATH"
export CHROMIUM_BIN=${{ steps.setup-chrome.outputs.chrome-path }}
export USE_CANARY=true
esbuild scripts/generateReport.ts > dist/report.mjs
node dist/report.mjs >> $GITHUB_STEP_SUMMARY
env:
DISCORD_TOKEN: ${{ secrets.DTOKEN }}
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK }}
esbuild scripts/generateReport.ts > dist/report.mjs
node dist/report.mjs >> $GITHUB_STEP_SUMMARY
env:
DISCORD_TOKEN: ${{ secrets.DTOKEN }}
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK }}

View file

@ -1,25 +1,25 @@
name: Sync Vencord Dev
env:
WORKFLOW_TOKEN: ${{ secrets.ETOKEN }}
UPSTREAM_URL: "https://github.com/Vendicated/Vencord.git"
UPSTREAM_BRANCH: "dev"
DOWNSTREAM_BRANCH: "dev"
WORKFLOW_TOKEN: ${{ secrets.ETOKEN }}
UPSTREAM_URL: "https://github.com/Vendicated/Vencord.git"
UPSTREAM_BRANCH: "dev"
DOWNSTREAM_BRANCH: "dev"
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Sync Vencord Dev
id: sync
uses: verticalsync/sync-upstream-repo@master
with:
upstream_repo: ${{ env.UPSTREAM_URL }}
upstream_branch: ${{ env.UPSTREAM_BRANCH }}
downstream_branch: ${{ env.DOWNSTREAM_BRANCH }}
token: ${{ env.WORKFLOW_TOKEN }}
build:
runs-on: ubuntu-latest
steps:
- name: Sync Vencord Dev
id: sync
uses: verticalsync/sync-upstream-repo@master
with:
upstream_repo: ${{ env.UPSTREAM_URL }}
upstream_branch: ${{ env.UPSTREAM_BRANCH }}
downstream_branch: ${{ env.DOWNSTREAM_BRANCH }}
token: ${{ env.WORKFLOW_TOKEN }}

View file

@ -1,25 +1,25 @@
name: Sync Vencord Main
env:
WORKFLOW_TOKEN: ${{ secrets.ETOKEN }}
UPSTREAM_URL: "https://github.com/Vendicated/Vencord.git"
UPSTREAM_BRANCH: "main"
DOWNSTREAM_BRANCH: "main"
WORKFLOW_TOKEN: ${{ secrets.ETOKEN }}
UPSTREAM_URL: "https://github.com/Vendicated/Vencord.git"
UPSTREAM_BRANCH: "main"
DOWNSTREAM_BRANCH: "main"
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Sync Vencord Main
id: sync
uses: verticalsync/sync-upstream-repo@master
with:
upstream_repo: ${{ env.UPSTREAM_URL }}
upstream_branch: ${{ env.UPSTREAM_BRANCH }}
downstream_branch: ${{ env.DOWNSTREAM_BRANCH }}
token: ${{ env.WORKFLOW_TOKEN }}
build:
runs-on: ubuntu-latest
steps:
- name: Sync Vencord Main
id: sync
uses: verticalsync/sync-upstream-repo@master
with:
upstream_repo: ${{ env.UPSTREAM_URL }}
upstream_branch: ${{ env.UPSTREAM_BRANCH }}
downstream_branch: ${{ env.DOWNSTREAM_BRANCH }}
token: ${{ env.WORKFLOW_TOKEN }}

View file

@ -1,65 +1,65 @@
name: Test
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
Test:
name: Test For Pushes
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
Test:
name: Test For Pushes
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint & Test if desktop version compiles
run: pnpm test
- name: Lint & Test if desktop version compiles
run: pnpm test
- name: Test if web version compiles
run: pnpm buildWeb
- name: Test if web version compiles
run: pnpm buildWeb
- name: Test if plugin structure is valid
run: pnpm generatePluginJson
- name: Test if plugin structure is valid
run: pnpm generatePluginJson
TestForPRs:
name: Test For Pull Requests
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
TestForPRs:
name: Test For Pull Requests
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint & Test if desktop version compiles
run: pnpm test
- name: Lint & Test if desktop version compiles
run: pnpm test
- name: Test if web version compiles
run: pnpm buildWeb
- name: Test if web version compiles
run: pnpm buildWeb
- name: Test if plugin structure is valid
run: pnpm generatePluginJson
- name: Test if plugin structure is valid
run: pnpm generatePluginJson

94
.github/workflows/uploadBuilds.yml vendored Normal file
View file

@ -0,0 +1,94 @@
name: Upload Builds
on:
workflow_run:
workflows: [Release]
types: [completed]
branches: [main, dev]
env:
FORCE_COLOR: true
REPO: Equicord/Builds
TOKEN: ${{ secrets.ETOKEN }}
USERNAME: GitHub-Actions
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
permissions: write-all
jobs:
Date:
name: Date
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
DATE: ${{ steps.combined.outputs.DATE }}
TIME: ${{ steps.combined.outputs.TIME }}
steps:
- name: Get Month Day Year
id: date
uses: Kaven-Universe/github-action-current-date-time@v1
with:
timezone-offset: 240
- name: Combine Time
id: combined
run: |
echo "DATE=$YEAR/$MONTH/$DAY" >> $GITHUB_OUTPUT
echo "TIME=$HOURS-$MINUTES-$SECONDS" >> $GITHUB_OUTPUT
env:
YEAR: ${{ steps.date.outputs.year }}
MONTH: ${{ steps.date.outputs.month }}
DAY: ${{ steps.date.outputs.day }}
HOURS: ${{ steps.date.outputs.hours }}
MINUTES: ${{ steps.date.outputs.minutes }}
SECONDS: ${{ steps.date.outputs.seconds }}
Upload:
name: Upload Build
runs-on: ubuntu-latest
needs: Date
env:
DATE: ${{ needs.Date.outputs.DATE }}
TIME: ${{ needs.Date.outputs.TIME }}
steps:
- uses: actions/checkout@v4
- name: Setup Actions User
run: |
git config --global user.name "GitHub-Actions"
git config --global user.email actions@github.com
- name: Download build artifact from triggered workflow
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{ github.event.workflow_run.id }}
name: build
path: ./release
search_artifacts: true
- name: Upload Stable Build to Builds repo
if: ${{ github.event.workflow_run.head_branch == 'main' }}
run: |
git clone https://$USERNAME:$TOKEN@github.com/$REPO.git builds
cd builds
mkdir -p stable/$DATE/$TIME
cp -r ../release/* ./stable/$DATE/$TIME
git add -A
git commit -m "Stable Build for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
git push --force https://$USERNAME:$TOKEN@github.com/$REPO.git
- name: Upload Dev Build To Builds Repo
if: ${{ github.event.workflow_run.head_branch == 'dev' }}
run: |
git clone https://$USERNAME:$TOKEN@github.com/$REPO.git builds
cd builds
mkdir -p devbuilds/$DATE/$TIME
cp -r ../release/* ./devbuilds/$DATE/$TIME
git add -A
git commit -m "Dev Build for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
git push --force https://$USERNAME:$TOKEN@github.com/$REPO.git

46
.github/workflows/uploadPlugins.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: Upload Plugins JSONs
on:
workflow_run:
workflows: [Release]
types: [completed]
branches: [main]
env:
FORCE_COLOR: true
REPO: Equicord/Equibored
TOKEN: ${{ secrets.ETOKEN }}
USERNAME: GitHub-Actions
permissions: write-all
jobs:
Upload:
name: Upload Plugins
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- name: Setup Actions User
run: |
git config --global user.name "GitHub-Actions"
git config --global user.email actions@github.com
- name: Download build artifact from triggered workflow
uses: dawidd6/action-download-artifact@v2
with:
run_id: ${{ github.event.workflow_run.id }}
name: build
path: ./release
search_artifacts: true
- name: Upload Plugins JSON to Equibored repo
run: |
git clone https://$USERNAME:$TOKEN@github.com/$REPO.git plugins
cd plugins
cp ../release/*plugins.json .
git add -A
git commit -m "Plugins for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
git push --force https://$USERNAME:$TOKEN@github.com/$REPO.git

View file

@ -225,11 +225,7 @@ async function parseFile(fileName: string) {
.replace(/\/index\.([jt]sx?)$/, "")
.replace(/^src\/plugins\//, "");
let readme = "";
try {
readme = readFileSync(join(fileName, "..", "README.md"), "utf-8");
} catch { }
return [data, readme] as const;
return [data] as const;
}
throw fail("no default export called 'definePlugin' found");
@ -260,23 +256,20 @@ function isPluginFile({ name }: { name: string; }) {
parseEquicordDevs();
const plugins = [] as PluginData[];
const readmes = {} as Record<string, string>;
await Promise.all(["src/plugins", "src/plugins/_core", "src/equicordplugins"].flatMap(dir =>
readdirSync(dir, { withFileTypes: true })
.filter(isPluginFile)
.map(async dirent => {
const [data, readme] = await parseFile(await getEntryPoint(dir, dirent));
const [data] = await parseFile(await getEntryPoint(dir, dirent));
plugins.sort().push(data);
if (readme) readmes[data.name] = readme;
})
));
const data = JSON.stringify(plugins);
if (process.argv.length > 3) {
if (process.argv.length > 2) {
writeFileSync(process.argv[2], data);
writeFileSync(process.argv[3], JSON.stringify(readmes));
} else {
console.log(data);
}

View file

@ -94,7 +94,7 @@ function ContributorModal({ user }: { user: User; }) {
</Forms.FormText>
) : (
<Forms.FormText>
{user.username} has not made any plugins. They likely {ContributedHyperLink} to Vencord in other ways!
{user.username} has not made any plugins. They likely {ContributedHyperLink} in other ways!
</Forms.FormText>
)}

View file

@ -1,5 +0,0 @@
User Messages Pronouns
Adds pronouns to chat user messages
![](https://github.com/user-attachments/assets/34dc373d-faf4-4420-b49b-08b2647baa3b)