From 863e990b32d737981257fd738cb985258ab8add6 Mon Sep 17 00:00:00 2001 From: Daniel Vu Date: Mon, 2 Oct 2023 00:26:54 -0400 Subject: [PATCH 1/2] Reduces build time --- .github/workflows/use-sdk.yml | 39 +++++++++++------------------------ 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/.github/workflows/use-sdk.yml b/.github/workflows/use-sdk.yml index 79e5f01c34a..ae83ec66b09 100644 --- a/.github/workflows/use-sdk.yml +++ b/.github/workflows/use-sdk.yml @@ -39,47 +39,32 @@ jobs: steps: - uses: actions/checkout@v3 - id: 'auth' + if: steps.filter.outputs.sheet == 'true' || steps.filter.outputs.force-update == 'true' uses: 'google-github-actions/auth@v1' with: credentials_json: '${{ secrets.SHEET_HTTP_GCP_KEYFILE }}' - name: 'Set up Cloud SDK' + if: steps.filter.outputs.sheet == 'true' || steps.filter.outputs.force-update == 'true' uses: 'google-github-actions/setup-gcloud@v1' - name: 'Use gcloud CLI' + if: steps.filter.outputs.sheet == 'true' || steps.filter.outputs.force-update == 'true' run: 'gcloud info' - uses: oven-sh/setup-bun@v1 + if: steps.filter.outputs.sheet == 'true' || steps.filter.outputs.force-update == 'true' - - run: sudo apt-get -y update && sudo apt-get -y install build-essential - # run any `bun` or `bunx` command - run: bun install + if: steps.filter.outputs.sheet == 'true' || steps.filter.outputs.force-update == 'true' working-directory: contrib/sheet-pixie + + # Handles when sheets have been updated individually - run: DEST_DIR=${{ runner.temp }}/${{ env.CDN_SHEETS_FOLDER }} bun run contrib/sheet-pixie/index.ts ${{ needs.changes.outputs.sheet-json }} + if: steps.filter.outputs.sheet == 'true' - run: gcloud storage rsync --project=roll20-actual ${{ runner.temp }}/${{ env.CDN_SHEETS_FOLDER }} gs://roll20-cdn/${{ env.CDN_SHEETS_FOLDER }} --cache-control='no-cache' --recursive + if: steps.filter.outputs.sheet == 'true' - force-update: - name: Process HTML/CSS for all character sheets (force-update) - needs: changes - if: ${{ needs.changes.outputs.sheet != 'true' && needs.changes.outputs.force-update == 'true'}} - runs-on: ubuntu-latest - env: - NPM_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} - CDN_SHEETS_FOLDER: ${{ vars.CDN_SHEETS_FOLDER }} - steps: - - uses: actions/checkout@v3 - - id: 'auth' - uses: 'google-github-actions/auth@v1' - with: - credentials_json: '${{ secrets.SHEET_HTTP_GCP_KEYFILE }}' - - name: 'Set up Cloud SDK' - uses: 'google-github-actions/setup-gcloud@v1' - - - name: 'Use gcloud CLI' - run: 'gcloud info' - - uses: oven-sh/setup-bun@v1 - - - run: sudo apt-get -y update && sudo apt-get -y install build-essential - # run any `bun` or `bunx` command - - run: bun install - working-directory: contrib/sheet-pixie + # Handles when a force-update has been requested (meaning all sheets will be re-built and deployed) - run: make all + if: steps.filter.outputs.force-update == 'true' - run: gcloud storage rsync --project=roll20-actual ${{ runner.temp }}/${{ env.CDN_SHEETS_FOLDER }} gs://roll20-cdn/${{ env.CDN_SHEETS_FOLDER }} --delete-unmatched-destination-objects --cache-control='no-cache' --recursive + if: steps.filter.outputs.force-update == 'true' From 049f5e6d8b745abf9ac37c85a67e3f89f32bff7a Mon Sep 17 00:00:00 2001 From: Daniel Vu Date: Mon, 2 Oct 2023 00:40:29 -0400 Subject: [PATCH 2/2] Fixes missing environment variables --- .github/workflows/use-sdk.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/use-sdk.yml b/.github/workflows/use-sdk.yml index ae83ec66b09..9686d6b6b47 100644 --- a/.github/workflows/use-sdk.yml +++ b/.github/workflows/use-sdk.yml @@ -1,11 +1,14 @@ name: Processes changed character-sheets and updates CDN bucket and/or sheet-http database as needed -on: - push: - branches: ["staging"] +on: push + +env: + NPM_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} jobs: - changes: + staging-deployment: + if: github.ref == 'refs/heads/staging' + environment: staging runs-on: ubuntu-latest # Set job outputs to values from filter step outputs: @@ -28,16 +31,6 @@ jobs: force-update: - added|modified: 'build.toml' - process-character-sheets: - name: Process character-sheet HTML/CSS - needs: changes - if: ${{ needs.changes.outputs.sheet == 'true' }} - runs-on: ubuntu-latest - env: - NPM_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} - CDN_SHEETS_FOLDER: ${{ vars.CDN_SHEETS_FOLDER }} - steps: - - uses: actions/checkout@v3 - id: 'auth' if: steps.filter.outputs.sheet == 'true' || steps.filter.outputs.force-update == 'true' uses: 'google-github-actions/auth@v1'