From 0414b24913829a79c00788eec18eb41b91f2df70 Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Sat, 9 Dec 2023 12:14:06 +1100 Subject: [PATCH] Removal of MMC Zips (#566) [SKIP] --- .github/workflows/buildpack.yml | 71 +------------ .github/workflows/forkprbuildpack.yml | 147 ++++++++++++++++++++++---- tools/gulpfile.ts | 4 +- tools/tasks/deploy/releases.ts | 2 +- tools/tasks/misc/zip.ts | 2 +- 5 files changed, 129 insertions(+), 97 deletions(-) diff --git a/.github/workflows/buildpack.yml b/.github/workflows/buildpack.yml index f254818..81a284d 100644 --- a/.github/workflows/buildpack.yml +++ b/.github/workflows/buildpack.yml @@ -34,7 +34,7 @@ on: required: false type: string separate_upload: - description: Whether to uploaed each zip (Client, Server, Lang & MMC) and the changelogs seperately. If not set, will just upload all six files into one artifact (Built Pack). + description: Whether to uploaed each zip (Client, Server, Lang) and the changelogs seperately. If not set, will just upload all six files into one artifact (Built Pack). required: true type: boolean @@ -259,7 +259,6 @@ jobs: - name: Upload Client Zip uses: actions/upload-artifact@v3 - if: ${{ inputs.separate_upload }} with: name: ${{ needs.makeNames.outputs.client }} path: ./build/client/**/* @@ -324,77 +323,11 @@ jobs: - name: Upload Server Zip uses: actions/upload-artifact@v3 - if: ${{ inputs.separate_upload }} with: name: ${{ needs.makeNames.outputs.server }} path: ./build/server/**/* if-no-files-found: error - buildMMC: - name: Build Pack MMC (${{ inputs.tag }}) - runs-on: ubuntu-latest - if: ${{ inputs.separate_upload }} - needs: makeNames - env: - GITHUB_TAG: ${{ inputs.tag }} - RELEASE_TYPE: ${{ inputs.release_type }} - GITHUB_HEAD_REF: ${{ inputs.head_ref }} - TRUE_SHA: ${{ inputs.true_sha }} - steps: - - name: Checkout Ref - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ inputs.tag }} - - - name: Restore Cached Files - uses: actions/cache@v3 - id: cache - with: - path: | - ~/.npm - ./.cache - ./tools/node_modules - key: ${{ runner.os }}-bunny-${{ hashFiles('**/.cache', '**/package-lock.json', '**/manifest.json') }} - restore-keys: ${{ runner.os }}-bunny- - - - name: Setup NodeJS v16 - uses: actions/setup-node@v3 - with: - node-version: "16" - check-latest: true - - - name: Setup NPM Packages - working-directory: ./tools - run: npm ci - - - name: Check Environmental Variables - working-directory: ./tools - run: npx gulp check - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CURSEFORGE_PROJECT_ID: ${{ secrets.CURSEFORGE_PROJECT_ID }} - CURSEFORGE_API_TOKEN: ${{ secrets.CURSEFORGE_API_TOKEN }} - CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} - - - name: Build MMC - working-directory: ./tools - run: npx gulp buildMMC - env: - CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} - CHANGELOG_BRANCH: ${{ inputs.changelog_branch }} - CHANGELOG_URL: ${{ inputs.changelog_url }} - CHANGELOG_CF_URL: ${{ inputs.changelog_cf_url }} - COMPARE_TAG: ${{ inputs.compare_tag }} - - - name: Upload MMC Zip - uses: actions/upload-artifact@v3 - if: ${{ inputs.separate_upload }} - with: - name: ${{ needs.makeNames.outputs.mmc }} - path: ./build/mmc/**/* - if-no-files-found: error - buildLang: name: Build Pack Lang and Changelogs (${{ inputs.tag }}) runs-on: ubuntu-latest @@ -454,7 +387,6 @@ jobs: - name: Upload Lang Zip uses: actions/upload-artifact@v3 - if: ${{ inputs.separate_upload }} with: name: ${{ needs.makeNames.outputs.lang }} path: ./build/lang/**/* @@ -462,7 +394,6 @@ jobs: - name: Upload Changelogs uses: actions/upload-artifact@v3 - if: ${{ inputs.separate_upload }} with: name: Changelogs path: ./build/*.md diff --git a/.github/workflows/forkprbuildpack.yml b/.github/workflows/forkprbuildpack.yml index 2a345b8..a7ff760 100644 --- a/.github/workflows/forkprbuildpack.yml +++ b/.github/workflows/forkprbuildpack.yml @@ -18,12 +18,52 @@ permissions: contents: read jobs: - build: + makeNames: # Only continue if we are in base Nomi-CEu Repo and pull request is from fork if: "${{ github.repository_owner == 'Nomi-CEu' && github.event.pull_request.head.repo.owner.login != 'Nomi-CEu' }}" - name: Fork PR Build Pack + name: Make Fork PR Artifact Names (${{ github.event.pull_request.head.sha }}) runs-on: ubuntu-latest environment: fork-pr-build-pack + env: + GITHUB_HEAD_REF: ${{ github.head_ref }} + TRUE_SHA: ${{ github.event.pull_request.head.sha }} + outputs: + client: ${{ steps.artifactNames.outputs.client }} + server: ${{ steps.artifactNames.outputs.server }} + lang: ${{ steps.artifactNames.outputs.lang }} + mmc: ${{ steps.artifactNames.outputs.mmc }} + steps: + - name: Checkout Ref + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + + # Don't use cache to prevent cache poisoning + + - name: Setup NodeJS v16 + uses: actions/setup-node@v3 + with: + node-version: "16" + check-latest: true + + - name: Setup NPM Packages + working-directory: ./tools + run: npm ci + + - name: Make Artifact Names + id: artifactNames + working-directory: ./tools + run: npx gulp makeArtifactNames + + buildClient: + # Only continue if we are in base Nomi-CEu Repo and pull request is from fork + if: "${{ github.repository_owner == 'Nomi-CEu' && github.event.pull_request.head.repo.owner.login != 'Nomi-CEu' }}" + name: Build Fork PR Client (${{ github.event.pull_request.head.sha }}) + runs-on: ubuntu-latest + environment: fork-pr-build-pack + needs: makeNames env: GITHUB_HEAD_REF: ${{ github.head_ref }} TRUE_SHA: ${{ github.event.pull_request.head.sha }} @@ -36,7 +76,7 @@ jobs: persist-credentials: false # Don't use cache to prevent cache poisoning - + - name: Setup NodeJS v16 uses: actions/setup-node@v3 with: @@ -47,42 +87,103 @@ jobs: working-directory: ./tools run: npm ci - - name: Build Pack + - name: Build Client working-directory: ./tools - run: npx gulp buildAll + run: npx gulp buildClient env: CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} - - - name: Zip Pack - working-directory: ./tools - run: npx gulp zipAll - + - name: Upload Client Zip uses: actions/upload-artifact@v3 with: - name: Client Zip - path: ./build/*-client.zip + name: ${{ needs.makeNames.outputs.client }} + path: ./build/client/**/* if-no-files-found: error + buildServer: + # Only continue if we are in base Nomi-CEu Repo and pull request is from fork + if: "${{ github.repository_owner == 'Nomi-CEu' && github.event.pull_request.head.repo.owner.login != 'Nomi-CEu' }}" + name: Build Fork PR Server (${{ github.event.pull_request.head.sha }}) + runs-on: ubuntu-latest + environment: fork-pr-build-pack + needs: makeNames + env: + GITHUB_HEAD_REF: ${{ github.head_ref }} + TRUE_SHA: ${{ github.event.pull_request.head.sha }} + steps: + - name: Checkout Ref + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + + # Don't use cache to prevent cache poisoning + + - name: Setup NodeJS v16 + uses: actions/setup-node@v3 + with: + node-version: "16" + check-latest: true + + - name: Setup NPM Packages + working-directory: ./tools + run: npm ci + + - name: Build Server + working-directory: ./tools + run: npx gulp buildServer + env: + CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} + - name: Upload Server Zip uses: actions/upload-artifact@v3 with: - name: Server Zip - path: ./build/*-server.zip + name: ${{ needs.makeNames.outputs.server }} + path: ./build/server/**/* if-no-files-found: error + buildLang: + # Only continue if we are in base Nomi-CEu Repo and pull request is from fork + if: "${{ github.repository_owner == 'Nomi-CEu' && github.event.pull_request.head.repo.owner.login != 'Nomi-CEu' }}" + name: Build Fork PR Lang and Changelogs (${{ github.event.pull_request.head.sha }}) + runs-on: ubuntu-latest + environment: fork-pr-build-pack + needs: makeNames + env: + GITHUB_HEAD_REF: ${{ github.head_ref }} + TRUE_SHA: ${{ github.event.pull_request.head.sha }} + steps: + - name: Checkout Ref + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + + # Don't use cache to prevent cache poisoning + + - name: Setup NodeJS v16 + uses: actions/setup-node@v3 + with: + node-version: "16" + check-latest: true + + - name: Setup NPM Packages + working-directory: ./tools + run: npm ci + + - name: Build Lang and Changelogs + working-directory: ./tools + run: npx gulp buildLang + env: + CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} + - name: Upload Lang Zip uses: actions/upload-artifact@v3 with: - name: Lang Zip - path: ./build/*-lang.zip - if-no-files-found: error - - - name: Upload MMC Zip - uses: actions/upload-artifact@v3 - with: - name: MMC Zip - path: ./build/*-mmc.zip + name: ${{ needs.makeNames.outputs.lang }} + path: ./build/lang/**/* if-no-files-found: error - name: Upload Changelogs diff --git a/tools/gulpfile.ts b/tools/gulpfile.ts index 0b79339..3794a5d 100644 --- a/tools/gulpfile.ts +++ b/tools/gulpfile.ts @@ -27,8 +27,8 @@ export const buildServer = gulp.series(gulp.parallel(sharedTasks, modTasks), ser export const buildLang = gulp.series(sharedTasks, langTasks); export const buildMMC = gulp.series(gulp.parallel(sharedTasks, modTasks), clientTasks, mmcTasks); export const buildAll = gulp.series( - gulp.parallel(sharedTasks, modTasks), - gulp.series(gulp.parallel(clientTasks, langTasks, serverTasks), mmcTasks), + sharedTasks, + gulp.parallel(clientTasks, langTasks, gulp.series(modTasks, serverTasks)), ); import checkTasks from "./tasks/checks"; diff --git a/tools/tasks/deploy/releases.ts b/tools/tasks/deploy/releases.ts index e2339d2..784161b 100644 --- a/tools/tasks/deploy/releases.ts +++ b/tools/tasks/deploy/releases.ts @@ -26,7 +26,7 @@ async function deployReleases(): Promise { }); const body = makeArtifactNameBody(modpackManifest.name); - const files = ["client", "server", "lang", "mmc"].map((file) => sanitize(`${body}-${file}.zip`.toLowerCase())); + const files = ["client", "server", "lang"].map((file) => sanitize(`${body}-${file}.zip`.toLowerCase())); /** * Obligatory file check. diff --git a/tools/tasks/misc/zip.ts b/tools/tasks/misc/zip.ts index 146e714..76519ab 100644 --- a/tools/tasks/misc/zip.ts +++ b/tools/tasks/misc/zip.ts @@ -43,4 +43,4 @@ export const zipClient = makeZipper(clientDestDirectory, "Client"); export const zipLang = makeZipper(langDestDirectory, "Lang"); export const zipMMC = makeZipper(mmcDestDirectory, "MMC"); -export const zipAll = gulp.parallel(zipServer, zipClient, zipLang, zipMMC); +export const zipAll = gulp.parallel(zipServer, zipClient, zipLang);