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
@ -76,19 +78,8 @@ jobs:
run: |
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/*"

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)