diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 00000000000..c317525de55 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,50 @@ +name: Build and deploy Pages + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: pages-${{ github.ref }} + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version: '3.12' + - name: Resolve and validate index URLs + run: python scripts/build_index.py --output "${{ runner.temp }}/index.html" + - name: Stage static site + run: | + mkdir _site + rsync -a --exclude='/.git/' --exclude='/.github/' --exclude='/scripts/' --exclude='/_site/' ./ _site/ + cp "${{ runner.temp }}/index.html" _site/index.html + touch _site/.nojekyll + - uses: actions/upload-pages-artifact@v4 + if: github.event_name != 'pull_request' + with: + path: _site + + deploy: + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + needs: build + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/configure-pages@v5 + - uses: actions/deploy-pages@v4 + id: deployment diff --git a/README.md b/README.md index 551187e3b2f..beda718503c 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,28 @@ Normative and historical IFC releases, including downloadable packages and indiv * **Addendum** - improvements to existing features. The schema may change while maintaining upward compatibility. * **Corrigendum** - documentation improvements. The schema does not change, although deprecations may be introduced. +## Website deployment + +The root `index.html` is the source template. File URLs may use globs in +their filenames, for example `IFC/DEV/IFC4_4/HTML/*.exp`. Keep directory paths +explicit. Each file URL on `standards.buildingsmart.org` (and each relative +file URL) must match exactly one file in the checkout. Zero or multiple matches +fail the build; directory URLs are assumed valid and external URLs are unchanged. +Only URLs in the root index are processed, not links inside generated publications. + +To generate and validate a separate index locally: + +```sh +python scripts/build_index.py --output /tmp/standards-index.html +``` + +The Pages workflow validates pull requests and deploys pushes to `main`, staging +the full static repository with the generated index and preserving `CNAME`. +In repository **Settings > Pages > Build and deployment**, set **Source** to +**GitHub Actions** instead of deploying from a branch. Build automation that pushes +publication updates must use credentials that trigger workflows (for example a +GitHub App token or PAT); pushes made with `GITHUB_TOKEN` do not trigger push workflows. + ## License Copyright © buildingSMART International Ltd. All Rights reserved until formal release. Final IFC is licensed under the **Creative Commons Attribution-NoDerivatives 4.0 International License (CC BY-ND 4.0)**. diff --git a/index.html b/index.html index 53903f1e0f1..01baf4d10b1 100644 --- a/index.html +++ b/index.html @@ -113,7 +113,7 @@