diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml new file mode 100644 index 0000000..88767a0 --- /dev/null +++ b/.github/workflows/deploy-prod.yml @@ -0,0 +1,39 @@ +name: Deploy production (celestiary.github.io) + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: + group: deploy-prod + cancel-in-progress: false + +permissions: + contents: read + +jobs: + deploy: + # Skip silently when the cross-repo deploy key hasn't been configured + # yet, so first-time setup doesn't fail the workflow. + if: ${{ secrets.CELESTIARY_GITHUB_IO_DEPLOY_KEY != '' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6.0.2 + + - uses: ./.github/actions/build + with: + base-path: / + + - name: Push built site to celestiary.github.io gh-pages + uses: JamesIves/github-pages-deploy-action@v4.8.0 + with: + repository-name: celestiary/celestiary.github.io + branch: gh-pages + folder: docs + ssh-key: ${{ secrets.CELESTIARY_GITHUB_IO_DEPLOY_KEY }} + clean: true + commit-message: "sync from celestiary/web@${{ github.sha }}" + git-config-name: github-actions[bot] + git-config-email: 41898282+github-actions[bot]@users.noreply.github.com diff --git a/README.md b/README.md index 936695c..8faaad2 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,18 @@ Edits in the source directory will be available in the app on a page refresh. For larger changes, it's also a good idea to step through the guide pages (in /guide) to make sure they'll all working. ## Deploy -The app runs at https://celestiary.github.io/ and is in the celestiary.github.io repo. From it grab the changes from the web repo and then push them: - -``` -git pull upstream main -git push -``` +The app is served at https://celestiary.github.io/ (user page, short URL) and +https://celestiary.github.io/web/ (project page). Both deploy automatically +on push to `main` from this repo: + +- `.github/workflows/gh-pages.yml` builds with `BASE_PATH=/web/` and pushes + to this repo's `gh-pages` branch root, serving the project page. +- `.github/workflows/deploy-prod.yml` builds with `BASE_PATH=/` and pushes + to `celestiary/celestiary.github.io`'s `gh-pages` branch via an SSH deploy + key (secret `CELESTIARY_GITHUB_IO_DEPLOY_KEY`), serving the user page. + +PR previews land at `celestiary.github.io/web/pr-preview/pr-NNN/` via +`.github/workflows/pr-preview.yml`. ## Performance A first-time session downloads ~3-5MB, mostly of the stars data. Planet textures are lazy-fetched as the user moves around the scene, but will bring that upwards to ~10MB in full.