Files
Thingport/.github/workflows/web-pages.yml
T

95 lines
2.8 KiB
YAML

name: Website
# Builds the static site in web/ and deploys it to GitHub Pages, when web/ or anything it renders
# or embeds changes (docs, READMEs, compose files, install.sh, logos, screenshots).
on:
push:
branches: [main]
paths:
- "web/**"
- "docs/**"
- "bridge/README.md"
- "extension/README.md"
- "extension/CONTRIBUTING.md"
- "extension/PRIVACY.md"
- "extension/docs/screenshots/**"
- "CONTRIBUTING.md"
- "docker-compose.deploy.yml"
- "install.sh"
- ".env.example"
- "frontend/src/assets/**"
- "frontend/public/**"
- ".github/workflows/web-pages.yml"
pull_request:
branches: [main]
paths:
- "web/**"
- "docs/**"
- "bridge/README.md"
- "extension/README.md"
- "extension/CONTRIBUTING.md"
- "extension/PRIVACY.md"
- "extension/docs/screenshots/**"
- "CONTRIBUTING.md"
- "docker-compose.deploy.yml"
- "install.sh"
- ".env.example"
- "frontend/src/assets/**"
- "frontend/public/**"
- ".github/workflows/web-pages.yml"
workflow_dispatch: {}
permissions:
contents: read
# One deployment at a time; a newer push supersedes a queued one, but never cancels one mid-deploy.
concurrency:
group: pages-${{ github.event_name == 'pull_request' && github.ref || 'deploy' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
ASTRO_TELEMETRY_DISABLED: "1"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: web/.nvmrc
cache: npm
cache-dependency-path: web/package-lock.json
# Supplies the Pages URL and base path. Skipped for PR builds, which may come from forks.
- id: pages
if: github.event_name != 'pull_request'
uses: actions/configure-pages@v5
- run: npm ci
working-directory: web
- run: npx astro check
working-directory: web
- run: npm run build
working-directory: web
env:
SITE_URL: ${{ steps.pages.outputs.origin }}
# A custom domain has an empty base_path, which must become "/" (empty means "use the default").
BASE_PATH: ${{ steps.pages.outputs.base_path || (github.event_name != 'pull_request' && '/' || '') }}
- if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v3
with:
path: web/dist
deploy:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4