Skip to content

[Submission] Frigid and Torrid (#189) #224

[Submission] Frigid and Torrid (#189)

[Submission] Frigid and Torrid (#189) #224

Workflow file for this run

name: "Upload Submissions"
concurrency: "upload"
on:
workflow_dispatch:
inputs:
ref:
description: "The branch or commit to upload artifacts from"
required: true
type: string
base_ref:
description: "The base ref to determine which artifacts to upload"
required: true
default: "HEAD~1"
type: string
push:
paths:
- "submissions/*.json"
- "metadata.json"
branches: ["main", "dev"]
jobs:
submit:
name: "Submit Artifacts"
uses: ./.github/workflows/submit.yaml
with:
mode: "upload"
ref: ${{ github.event.inputs.ref || github.ref }}
# We default to HEAD~1 for push events.
base_ref: ${{ github.event.inputs.base_ref || 'HEAD~1' }}
secrets: inherit
generate:
name: "Generate Hugo Files"
needs: submit
runs-on: ubuntu-latest
env:
PROD: ${{ contains(fromJSON('["main", "refs/heads/main"]'), github.event.inputs.ref || github.ref) }}
steps:
- name: "Generate Token"
id: token
# This action is being passed secrets, so we're pinning it to a specific
# rev for security. This action is very simple, so it's easy to audit.
uses: tibdex/github-app-token@f717b5ecd4534d3c4df4ce9b5c1c2214f0f7cd06
with:
app_id: ${{ vars.GH_APP_ID }}
permissions: >-
{"contents": "write"}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
repository: "acearchive/hugo-artifacts"
- name: "Checkout"
uses: actions/checkout@v4
with:
repository: "acearchive/hugo-artifacts"
token: ${{ steps.token.outputs.token }}
ref: ${{ env.PROD == 'true' && 'main' || 'dev' }}
- name: "Generate Files"
uses: "acearchive/hugo-artifact-action@main"
with:
endpoint: "https://${{ env.PROD == 'true' && vars.API_DOMAIN || vars.API_DEV_DOMAIN }}/v0"
- name: "Commit Changes"
uses: "stefanzweifel/git-auto-commit-action@v4"
with:
commit_message: "Apply automatic changes"
file_pattern: "metadata.json artifacts.json artifacts/*.md"
disable_globbing: true
sync:
name: "Update Site"
needs: generate
runs-on: ubuntu-latest
env:
PROD: ${{ contains(fromJSON('["main", "refs/heads/main"]'), github.event.inputs.ref || github.ref) }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
repository: acearchive/acearchive.lgbt
ref: ${{ env.PROD == 'true' && 'prod' || 'main' }}
lfs: true
- name: "Install"
run: npm ci
- name: "Sync Artifacts (dev)"
if: env.PROD == 'false'
working-directory: ./site/
run: npm run sync:dev
- name: "Sync Artifacts (prod)"
if: env.PROD == 'true'
working-directory: ./site/
run: npm run sync:prod
- name: "Build (dev)"
if: env.PROD == 'false'
working-directory: ./site/
run: npm run build:dev
- name: "Build (prod)"
if: env.PROD == 'true'
working-directory: ./site/
run: npm run build:prod
- name: "Deploy"
uses: cloudflare/wrangler-action@v3
with:
environment: ${{ env.PROD == 'true' && 'prod' || 'dev' }}
wranglerVersion: latest
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}