mirror of
https://github.com/Nighthawk42/roll20-character-sheets.git
synced 2026-09-01 04:32:28 +00:00
88 lines
3.0 KiB
YAML
88 lines
3.0 KiB
YAML
name: Processes changed character-sheets and updates CDN bucket and/or sheet-http database as needed
|
|
|
|
on:
|
|
push:
|
|
branches: ["staging"]
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
# Set job outputs to values from filter step
|
|
outputs:
|
|
sheet: ${{ steps.filter.outputs.sheet }}
|
|
sheet-json: ${{ steps.filter.outputs.sheet_files }}
|
|
force-update: ${{ steps.filter.outputs.force-update }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: dorny/paths-filter@v2
|
|
id: filter
|
|
with:
|
|
# Enable listing of files matching each filter.
|
|
# Paths to files will be available in `${FILTER_NAME}_files` output variable.
|
|
# Paths will be escaped and space-delimited.
|
|
# Output is usable as command-line argument list in Linux shell
|
|
list-files: shell
|
|
filters: |
|
|
sheet:
|
|
- added|modified: '*/sheet.json'
|
|
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'
|
|
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
|
|
- run: make clean
|
|
- run: bun run contrib/sheet-pixie/index.ts ${{ needs.changes.outputs.sheet-json }}
|
|
- run: gcloud storage rsync --project=roll20-actual ${{ runner.temp }} "gs://roll20-cdn/$CDN_SHEETS_FOLDER" --cache-control='no-cache'
|
|
|
|
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
|
|
- run: make clean
|
|
- run: make all
|
|
- run: bash force-update.sh ${{ runner.temp }}
|