Skip to content

Commit

Permalink
Adds force-update mechanism (to upload all sheets)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielxvu committed Oct 1, 2023
1 parent ca6ed37 commit 6258589
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/use-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
filters: |
sheet:
- added|modified: '*/sheet.json'
force-update:
- added|modified: 'build.toml'
process-character-sheets:
name: Process character-sheet HTML/CSS
Expand Down Expand Up @@ -61,3 +63,40 @@ jobs:
- run: bun run contrib/sheet-pixie/index.ts ${{ needs.changes.outputs.sheet_files }}
- run: bash update.sh
- run: bash sync_sheets.sh


force-update:
name: Process HTML/CSS for all character sheets (force-update)
needs: changes
if: ${{ 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
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions-rs/cargo@v1
with:
command: install
args: fd-find
- run: make clean
- run: make all
- run: bash force-update.sh
2 changes: 2 additions & 0 deletions build.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sheets.all]
force-updated-at = 2023-10-01T12:57:56-04:00
8 changes: 1 addition & 7 deletions force-update.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
#!/bin/bash

rm -rf sync_sheets.sh
touch sync_sheets.sh
echo '#!/bin/bash' > sync_sheets.sh
echo 'set -e' >> sync_sheets.sh
chmod +x sync_sheets.sh
fd sheet -e json --strip-cwd-prefix -j1 --exec bash -c 'echo ./gcp.sh \"$(printf "%s" "{//}")\" \"$(printf "gs://roll20-cdn/$CDN_SHEETS_FOLDER/%s\n" "{//}")\" \"$(printf "%s" "{//}")/dist\" \"$(printf "%s" "{//}")/translations\"' | tee -a sync_sheets.sh

gcloud storage rsync --project=roll20-actual gs://roll20-cdn/$CDN_SHEETS_FOLDER --delete-unmatched-destination-objects --cache-control='no-cache'

0 comments on commit 6258589

Please sign in to comment.