From 4ae1d01dd3718bbb0ce4bacad38e801675919cce Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 1 Nov 2024 11:19:24 -0400 Subject: [PATCH] Rework More --- .github/workflows/build.yml | 53 +++++++--- .github/workflows/buildDev.yml | 113 ++++++++++++++++++++++ .github/workflows/reportBrokenPlugins.yml | 3 +- .github/workflows/uploadBuilds.yml | 64 +++++------- .github/workflows/uploadPlugins.yml | 7 +- 5 files changed, 185 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/buildDev.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5dd6bdbe..5da41bea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,8 @@ -name: Release +name: Release Stable on: push: branches: - main - - dev env: FORCE_COLOR: true GITHUB_TOKEN: ${{ secrets.ETOKEN }} @@ -11,9 +10,40 @@ env: permissions: write-all jobs: - Build: - name: Build Equicord + Date: + name: Date runs-on: ubuntu-latest + 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 }} + + Build: + name: Build Equicord Stable + runs-on: ubuntu-latest + needs: Date + env: + DATE: ${{ needs.Date.outputs.DATE }} + TIME: ${{ needs.Date.outputs.TIME }} steps: - uses: actions/checkout@v4 @@ -36,7 +66,7 @@ jobs: run: pnpm buildStandalone - name: Generate plugin list - run: pnpm generatePluginJson dist/vencordplugins.json + run: pnpm generatePluginJson dist/allplugins.json - name: Generate Equicord plugin list run: pnpm generateEquicordPluginJson dist/equicordplugins.json @@ -69,17 +99,18 @@ jobs: rm release/*.map - name: Upload Equicord Stable - if: ${{ github.ref_name == 'main' }} run: | gh release upload latest --clobber dist/release/* - - name: Upload Equicord Dev - if: ${{ github.ref_name == 'dev' }} + - name: Move Files To Date Time dir run: | - gh release upload devbuild --clobber dist/release/* + mkdir -p $DATE/$TIME + mv /dist/release/* $DATE/$TIME + cd $DATE/$TIME + echo '$DATE/$TIME' >> time.txt - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: "build" - path: "dist/release/*" + name: "buildStable" + path: "$DATE/$TIME/*" diff --git a/.github/workflows/buildDev.yml b/.github/workflows/buildDev.yml new file mode 100644 index 00000000..a07f7047 --- /dev/null +++ b/.github/workflows/buildDev.yml @@ -0,0 +1,113 @@ +name: Release Dev +on: + push: + branches: + - dev +env: + FORCE_COLOR: true + GITHUB_TOKEN: ${{ secrets.ETOKEN }} + +permissions: write-all + +jobs: + Date: + name: Date + runs-on: ubuntu-latest + 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 }} + + Build: + name: Build Equicord Dev + runs-on: ubuntu-latest + needs: Date + env: + DATE: ${{ needs.Date.outputs.DATE }} + TIME: ${{ needs.Date.outputs.TIME }} + + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v3 + + - 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: Build web + run: pnpm buildWeb + + - name: Build + run: pnpm build + + - name: Generate plugin list + run: pnpm generatePluginJson dist/allplugins.json + + - name: Collect files to be released + run: | + cd dist + mkdir release + + cp browser/browser.* release + cp Vencord.user.{js,js.LEGAL.txt} release + + # copy the plugin data jsons, the extension zips and the desktop/vesktop asars + cp *.{json,zip,asar} release + + # legacy un-asared files + # FIXME: remove at some point + cp desktop/* release + for file in vesktop/*; do + filename=$(basename "$file") + cp "$file" "release/vencordDesktop${filename^}" + done + for file in equibop/*; do + filename=$(basename "$file") + cp "$file" "release/equicordDesktop${filename^}" + done + + find release -size 0 -delete + rm release/package.json + rm release/*.map + + - name: Upload Equicord Dev + run: | + gh release upload devbuild --clobber dist/release/* + + - name: Move Files To Date Time dir + run: | + mkdir -p $DATE/$TIME + mv /dist/release/* $DATE/$TIME + cd $DATE/$TIME + echo '$DATE/$TIME' >> time.txt + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "buildDev" + path: "$DATE/$TIME/*" diff --git a/.github/workflows/reportBrokenPlugins.yml b/.github/workflows/reportBrokenPlugins.yml index 0abfee5b..b4d53652 100644 --- a/.github/workflows/reportBrokenPlugins.yml +++ b/.github/workflows/reportBrokenPlugins.yml @@ -2,7 +2,6 @@ name: Test Patches on: workflow_dispatch: schedule: - # Every day at midnight - cron: 0 0 * * * jobs: @@ -19,7 +18,7 @@ jobs: - 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 - name: Use Node.js 20 uses: actions/setup-node@v4 diff --git a/.github/workflows/uploadBuilds.yml b/.github/workflows/uploadBuilds.yml index 989db697..4f7fe2aa 100644 --- a/.github/workflows/uploadBuilds.yml +++ b/.github/workflows/uploadBuilds.yml @@ -1,9 +1,11 @@ name: Upload Builds on: + workflow_dispatch: workflow_run: - workflows: [Release] + workflows: [Release Stable, Release Dev] types: [completed] - branches: [main, dev] + schedule: + - cron: 0 0 * * * env: FORCE_COLOR: true REPO: Equicord/Builds @@ -15,41 +17,9 @@ concurrency: 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 @@ -60,21 +30,37 @@ jobs: git config --global user.email actions@github.com - name: Download build artifact from triggered workflow + if: ${{ github.event.workflow_run.head_branch == 'main' }} uses: dawidd6/action-download-artifact@v2 with: run_id: ${{ github.event.workflow_run.id }} - name: build + name: buildStable path: ./release search_artifacts: true + - name: Download build artifact from triggered workflow + if: ${{ github.event.workflow_run.head_branch == 'dev' }} + uses: dawidd6/action-download-artifact@v2 + with: + run_id: ${{ github.event.workflow_run.id }} + name: buildDev + path: ./${{ github.event.workflow_run.event }} + search_artifacts: true + + - name: Get time + id: time + run: | + cd release + echo "TIME=$(cat time.txt)" >> $GITHUB_ENV + - 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 + mkdir -p stable/$TIME + cp -r ../release/* ./stable/$TIME git add -A git commit -m "Stable Build for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA" @@ -86,8 +72,8 @@ jobs: git clone https://$USERNAME:$TOKEN@github.com/$REPO.git builds cd builds - mkdir -p devbuilds/$DATE/$TIME - cp -r ../release/* ./devbuilds/$DATE/$TIME + mkdir -p devbuilds/$TIME + cp -r ../release/* ./devbuilds/$TIME git add -A git commit -m "Dev Build for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA" diff --git a/.github/workflows/uploadPlugins.yml b/.github/workflows/uploadPlugins.yml index 8edd474f..f8481fff 100644 --- a/.github/workflows/uploadPlugins.yml +++ b/.github/workflows/uploadPlugins.yml @@ -1,9 +1,11 @@ name: Upload Plugins JSONs on: + workflow_dispatch: workflow_run: - workflows: [Release] + workflows: [Release Stable] types: [completed] - branches: [main] + schedule: + - cron: 0 0 * * * env: FORCE_COLOR: true REPO: Equicord/Equibored @@ -16,7 +18,6 @@ jobs: Upload: name: Upload Plugins runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v4