Assemble and Deploy Live Site #72
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Assemble and Deploy Live Site | |
| on: | |
| workflow_run: | |
| workflows: ['Build Static Site'] | |
| types: | |
| - completed | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| permissions: {} | |
| concurrency: | |
| group: "site_build" | |
| cancel-in-progress: true | |
| jobs: | |
| # This job downloads and extracts every release that has a splashkitonline-static-site-....zip asset | |
| # It then arranges them into folders, de-duplicates large files, and deploys the result as the GitHub Pages site. | |
| deploy: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| pull-requests: write | |
| environment: | |
| name: static-site | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Scripts | |
| uses: actions/checkout@v4 | |
| with: | |
| path: script | |
| sparse-checkout: | | |
| .github/workflows/ | |
| sparse-checkout-cone-mode: false | |
| - name: Download Built Sites | |
| working-directory: ./ | |
| run: | | |
| sudo apt-get install tree | |
| python3 ./script/.github/workflows/download_github_site_previews.py "${{ github.repository }}" static-site | |
| tree | |
| # the directories are named based on the Git tag - let's rename them | |
| cd static-site | |
| mkdir -p "./branch" # just in case | |
| mkdir -p "./pr" # just in case | |
| mv branch branch-previews | |
| mv pr pr-previews | |
| - name: Structure Deployment # Put everything inside the `deployed` branch's folder | |
| working-directory: ./static-site | |
| run: | | |
| mkdir -p "./branch-previews/deployed" # just in case | |
| mv "./branch-previews/deployed" ../deployed | |
| mv ./* ../deployed/ | |
| - name: De-duplicate # I really wish GitHub supported hardlinks at least, this would have been much less painful...and save them space! | |
| working-directory: ./deployed | |
| run: python3 ../script/.github/workflows/generate_pr_map.py | |
| - name: Delete existing page artifact # allows re-run of workflow | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: github-pages | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| # Upload IDE site | |
| path: './deployed' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |