From c0bfe2693ddcdddda4046d7549765f5c21fcc3a0 Mon Sep 17 00:00:00 2001 From: jalensailin Date: Thu, 11 Dec 2025 23:06:29 -0500 Subject: [PATCH] Add hotfix-dev release to github action workflow --- .github/actions/build-packs/action.yml | 3 +- .github/actions/setup-node/action.yml | 3 +- .github/actions/zip-system/action.yml | 15 +---- .github/workflows/publish-dev-release.yml | 68 +++++++++++++++++------ CONTRIBUTING.md | 3 +- 5 files changed, 59 insertions(+), 33 deletions(-) diff --git a/.github/actions/build-packs/action.yml b/.github/actions/build-packs/action.yml index ec50a58..1c9ffd2 100644 --- a/.github/actions/build-packs/action.yml +++ b/.github/actions/build-packs/action.yml @@ -1,5 +1,6 @@ name: "Build Compendium Packs" description: "Builds the compendium pack binaries from source JSON files" + runs: using: "composite" steps: @@ -7,5 +8,5 @@ runs: uses: ./.github/actions/setup-node - name: Build Compendium Packs - run: ./build/build-packs.sh shell: bash + run: ./build/build-packs.sh diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index f36e1de..1b77216 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -1,5 +1,6 @@ name: "Setup Node Project" description: "Sets up a Node.js project" + runs: using: "composite" steps: @@ -10,5 +11,5 @@ runs: cache: npm - name: Install dependencies - run: npm ci shell: bash + run: npm ci diff --git a/.github/actions/zip-system/action.yml b/.github/actions/zip-system/action.yml index ab61cdd..05de808 100644 --- a/.github/actions/zip-system/action.yml +++ b/.github/actions/zip-system/action.yml @@ -1,27 +1,18 @@ name: "Zip Project" description: "Zips the project for distribution" -inputs: - path: - description: "Path to output directory for zip file" - required: false - default: "" runs: using: "composite" steps: - name: Zip shell: bash run: | - if [[ -z "${{ inputs.path }}" ]]; then - OUTPUT_PATH="deltagreen.zip" - else - OUTPUT_PATH="${{ inputs.path }}/deltagreen.zip" - fi - zip -r "${OUTPUT_PATH}" . \ + zip -r deltagreen.zip . \ -x "packs/source/*" \ -x "build/*" \ -x "dist/*" \ -x ".*" \ -x "package.json" \ -x "package-lock.json" \ - -x "node_modules/*" + -x "node_modules/*" \ + -x "site/*" diff --git a/.github/workflows/publish-dev-release.yml b/.github/workflows/publish-dev-release.yml index b867b12..fbd3dd0 100644 --- a/.github/workflows/publish-dev-release.yml +++ b/.github/workflows/publish-dev-release.yml @@ -1,19 +1,15 @@ -name: Dev Build (GitHub Pages) - on: push: branches: - master + - hotfix/** workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false @@ -23,37 +19,73 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout + # ------------------------------- + # 1. Checkout SOURCE code + # ------------------------------- + - name: Checkout source repo uses: actions/checkout@v4 + # ------------------------------- + # 2. Create useful variables/output. + # ------------------------------- + - name: Compute branch folder + id: vars + shell: bash + run: | + BRANCH="${GITHUB_REF#refs/heads/}" + + if [[ "$BRANCH" == "master" ]]; then + TARGET="dev" + NON_TARGET="hotfix" + else + TARGET="hotfix" + NON_TARGET="dev" + fi + + echo "target=$TARGET" >> $GITHUB_OUTPUT + echo "non_target=$NON_TARGET" >> $GITHUB_OUTPUT + + # ------------------------------- + # 3. Build and Zip the system + # ------------------------------- - name: Build Packs uses: ./.github/actions/build-packs - name: Substitute Download Link uses: TomaszKandula/variable-substitution@v1.0.1 with: - files: "system.json" + files: system.json env: - version: dev - download: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/dev/deltagreen.zip - - - name: Copy system.json - run: mkdir -p dist/dev && cp system.json dist/dev/dev-system.json + version: ${{ steps.vars.outputs.target }} + download: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ steps.vars.outputs.target }}/deltagreen.zip - name: Zip uses: ./.github/actions/zip-system - with: - path: "dist/dev" - # Deploy to GitHub Pages (see https://github.com/actions/starter-workflows/blob/main/pages/static.yml) + # ------------------------------- + # 4. Deploy to Github Pages + # ------------------------------- + - name: Create Site Structure + shell: bash + run: | + # Create site directories. + mkdir -p site/dev site/hotfix + + # Download files from non-target build. + URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ steps.vars.outputs.non_target }}" + wget -O site/${{ steps.vars.outputs.non_target }}/deltagreen.zip "$URL"/deltagreen.zip + wget -O site/${{ steps.vars.outputs.non_target }}/system.json "$URL"/system.json + + # Copy files from current build. + cp system.json deltagreen.zip site/${{ steps.vars.outputs.target }}/ + - name: Setup Pages uses: actions/configure-pages@v5 - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: "dist" + path: site - - name: Deploy to GitHub Pages - id: deployment + - name: Deploy uses: actions/deploy-pages@v4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 07298f9..acbf6db 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -222,7 +222,8 @@ It is difficult to create a one-size-fits-all procedure for testing, because eac - If you do not follow the above advice, be aware that opening your main world while you have an in-progress (non-release) version of the system installed **will almost certainly break things in a way that cannot be fixed**. To go back to the release version of the system, uninstall the test build, and reinstall from the in-Foundry system browser. - Update to the target build: - Development setup: `git checkout` the target branch (or `master` for merged work), then restart Foundry. - - No dev setup: Install or update the system from the dev manifest: + - No dev setup: Install or update the system from the dev manifest: + - **Note**: Testing a **hotfix** branch? Use the hotfix manifest instead: - Use a clean test world: - Create a fresh world - Note, this is a good practice, but is not always strictly necessary. If you run into anything weird, a completely fresh world is always a good rule-out test.