Skip to content

Commit

Permalink
Merge branch 'feature/CSC-1652-gh-action-for-processing-custom-sheets…
Browse files Browse the repository at this point in the history
…' into staging
  • Loading branch information
danielxvu committed Oct 2, 2023
2 parents ca76c1f + 049f5e6 commit 808bb21
Showing 1 changed file with 19 additions and 41 deletions.
60 changes: 19 additions & 41 deletions .github/workflows/use-sdk.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -28,58 +31,33 @@ 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'
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'

0 comments on commit 808bb21

Please sign in to comment.