-
Notifications
You must be signed in to change notification settings - Fork 27
[CHORE] Add SCHEMA_PREVIEW build mode + misc. fixes for publishing #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
f3b3392
fix: resolve broken anchor links
lowlydba 98a4b30
fix: html minifier warning about orphaned </p> post render
lowlydba d8da5fb
add dependabot for npm
lowlydba 350c825
update to LTS node, remove unused dep
lowlydba 480ed5b
add schema preview build + error for broken anchors
lowlydba 64e03b7
Use package.json node version and switch to npm ci
lowlydba a689b3d
Update package-lock.json
lowlydba 97bb21e
Update staging_deploy.yaml
lowlydba 61d176f
Update staging_deploy.yaml
lowlydba fa84d18
Update staging_deploy.yaml
lowlydba d251fe7
Update staging_deploy.yaml
lowlydba c907801
Update staging_deploy.yaml
lowlydba 3a49705
Throw on duplicate routes; rename places README to fix dup route
lowlydba a4f485a
Update staging_deploy.yaml
lowlydba 32a61b1
Update staging_deploy.yaml
lowlydba bb4e267
Update staging_deploy.yaml
lowlydba 65788dc
Update staging_deploy.yaml
lowlydba 84aed71
Update staging_deploy.yaml
lowlydba c635a53
Update staging_deploy.yaml
lowlydba bd8e50f
Update staging_deploy.yaml
lowlydba 97ff699
Create staging_deploy_cleanup.yaml
lowlydba 5316536
chore: make it pretty
lowlydba d33be9c
Merge branch 'main' into jmccall-schema-docs-builds
lowlydba 50be914
chore: check if fork before building
lowlydba 3fab10a
feat: use more human-friendly ts format
lowlydba 5fbc8fe
fix: copilot suggestions
lowlydba 580a276
fix: SSR mismatch with browser-only component
lowlydba 7372b07
Revert "fix: SSR mismatch with browser-only component"
lowlydba 5cd4e08
Update staging_deploy.yaml
lowlydba d8dd6de
Remove generated schema reference docs; add .gitkeep
lowlydba b38162a
Revert "Remove generated schema reference docs; add .gitkeep"
lowlydba fa3a505
Update staging_deploy.yaml
lowlydba 33d8c64
Merge branch 'main' into jmccall-schema-docs-builds
lowlydba d798b38
Update staging_deploy.yaml
lowlydba 87c4c11
Merge branch 'jmccall-schema-docs-builds' of https://github.com/Overt…
lowlydba 5e9e18b
Update staging_deploy.yaml
lowlydba 8cfbff4
Update staging_deploy.yaml
lowlydba 7aaf415
Update staging_deploy.yaml
lowlydba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,84 +1,172 @@ | ||
| --- | ||
| name: Staging Deploy | ||
| run-name: Publish docs to staging website (for PR) | ||
| run-name: Publish docs to staging website | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| concurrency: | ||
| group: staging-deploy-${{ github.event.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| env: | ||
| DOCS_PATH: docs | ||
| PREVIEW_PATH: /${{ github.event.repository.name }}/pr/${{ github.event.number }} | ||
| PREVIEW_PATH_NO_AUTOGEN: /${{ github.event.repository.name }}/pr/${{ github.event.number }}-no-autogen | ||
| STAGING_URL: https://staging.overturemaps.org | ||
| SCHEMA_PREVIEW: false # Set to true to only publish Schema reference docs | ||
| AWS_ROLE_ARN: arn:aws:iam::763944545891:role/pages-staging-oidc-overturemaps | ||
| AWS_REGION: us-west-2 | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| check-fork: | ||
| name: Check fork | ||
| runs-on: ubuntu-slim | ||
| steps: | ||
| - name: Staging deploy is not supported for fork PRs | ||
lowlydba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if: github.event.pull_request.head.repo.full_name != github.repository | ||
| run: | | ||
| echo "::warning title=Staging deploy not supported for fork PRs::Staging previews are only available for PRs from branches within this repository, not forks. Please open your PR from a branch in OvertureMaps/docs instead." | ||
|
|
||
| build-auto-gen: | ||
| name: Build (auto-gen schema) | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-latest | ||
| needs: check-fork | ||
| outputs: | ||
| schema-sha: ${{ steps.schema-docs.outputs.schema-sha }} | ||
| schema-ref: ${{ steps.schema-docs.outputs.schema-ref }} | ||
| steps: | ||
| - name: Check out the main docs repo repository and build. | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: '24' | ||
| node-version-file: 'package.json' | ||
|
|
||
| - uses: lowlydba/sustainable-npm@v2 | ||
|
|
||
| - name: Install NPM dependencies | ||
| run: npm ci --omit=dev | ||
| - run: npm ci --omit=dev | ||
|
|
||
| - name: Generate schema markdown docs | ||
| id: schema-docs | ||
| uses: OvertureMaps/workflows/.github/actions/generate-schema-docs@main | ||
lowlydba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| with: | ||
| output-dir: ${{ github.workspace }}/docs/schema/reference | ||
| schema-ref: 'dev' # Temporary until we feel confident in the generated schema sans human review, then should be 'main' | ||
|
|
||
| - name: Build Docusaurus website | ||
| env: | ||
| DOCUSAURUS_URL: https://staging.overturemaps.org/ | ||
| DOCUSAURUS_BASE_URL: /${{ github.event.repository.name }}/pr/${{ github.event.number }}/ | ||
| run: npm run build | ||
| env: | ||
| DOCUSAURUS_URL: ${{ env.STAGING_URL }}/ | ||
| DOCUSAURUS_BASE_URL: ${{ env.PREVIEW_PATH }}/ | ||
| SCHEMA_PREVIEW: ${{ env.SCHEMA_PREVIEW }} | ||
|
|
||
| - name: Upload docs build as an artifact 📦 | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| path: build | ||
| name: build-artifact | ||
|
|
||
| build-repo-schema: | ||
| # Branch ruleset set to this job name to require this status check | ||
| name: Build | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-latest | ||
| needs: check-fork | ||
| steps: | ||
| - name: Check out the main docs repo repository and build. | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: 'package.json' | ||
|
|
||
| - uses: lowlydba/sustainable-npm@v2 | ||
|
|
||
| - run: npm ci --omit=dev | ||
|
|
||
| - name: Build Docusaurus website (using existing /schema/reference files) | ||
| run: npm run build | ||
| env: | ||
| DOCUSAURUS_URL: ${{ env.STAGING_URL }}/ | ||
| DOCUSAURUS_BASE_URL: ${{ env.PREVIEW_PATH_NO_AUTOGEN }}/ | ||
| SCHEMA_PREVIEW: ${{ env.SCHEMA_PREVIEW }} | ||
|
|
||
| - name: Upload docs build as an artifact 📦 | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| path: build | ||
| name: build-artifact-no-autogen | ||
|
|
||
| deploy: | ||
| name: Deploy | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| runs-on: ubuntu-slim | ||
| needs: [check-fork, build-auto-gen, build-repo-schema] | ||
| environment: | ||
| name: staging | ||
| url: https://staging.overturemaps.org/${{ github.event.repository.name }}/pr/${{ github.event.number }}/index.html | ||
| url: ${{ env.STAGING_URL }}${{ env.PREVIEW_PATH }}/index.html | ||
|
|
||
| steps: | ||
| - name: Configure AWS credentials 🔐 | ||
| uses: aws-actions/configure-aws-credentials@v6 | ||
| with: | ||
| role-to-assume: arn:aws:iam::763944545891:role/pages-staging-oidc-overturemaps | ||
| aws-region: us-west-2 | ||
| role-to-assume: ${{ env.AWS_ROLE_ARN }} | ||
| aws-region: ${{ env.AWS_REGION }} | ||
|
|
||
| - name: Download artifacts 📥 | ||
| - name: Download auto-gen artifact 📥 | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: build-artifact | ||
| path: build | ||
| path: build-autogen | ||
|
|
||
| - name: Download repo schema artifact 📥 | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: build-artifact-no-autogen | ||
| path: build-no-autogen | ||
|
|
||
| - name: Copy to S3 | ||
| run: | | ||
| aws s3 sync --delete build s3://overture-managed-staging-usw2/gh-pages/${{ github.event.repository.name }}/pr/${{ github.event.number }}/ | ||
| aws s3 sync --delete --quiet build-autogen s3://overture-managed-staging-usw2/gh-pages${{ env.PREVIEW_PATH }}/ | ||
| aws s3 sync --delete --quiet build-no-autogen s3://overture-managed-staging-usw2/gh-pages${{ env.PREVIEW_PATH_NO_AUTOGEN }}/ | ||
|
|
||
| - name: Bust the Cache | ||
| run: aws cloudfront create-invalidation --distribution-id E1KP2IN0H2RGGT --paths "/${{ github.event.repository.name }}/pr/${{ github.event.number }}/*" | ||
| run: | | ||
| aws cloudfront create-invalidation --distribution-id E1KP2IN0H2RGGT --paths "${{ env.PREVIEW_PATH }}/*" "${{ env.PREVIEW_PATH_NO_AUTOGEN }}/*" | ||
|
|
||
| - name: Get deploy timestamp | ||
| id: timestamp | ||
| run: echo "time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | ||
| - name: Gather metadata for PR comment | ||
| id: deploy-metadata | ||
| run: | | ||
| echo "time=$(date -u +'%b %d, %Y %H:%M UTC')" >> $GITHUB_OUTPUT | ||
| echo "short-sha=$(echo '${{ github.event.pull_request.head.sha }}' | cut -c1-7)" >> $GITHUB_OUTPUT | ||
| echo "schema-ref-short=$(echo '${{ needs.build-auto-gen.outputs.schema-ref }}' | sed 's|refs/heads/||;s|refs/tags/||')" >> $GITHUB_OUTPUT | ||
| echo "schema-short-sha=$(echo '${{ needs.build-auto-gen.outputs.schema-sha }}' | cut -c1-7)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Comment on PR | ||
| uses: marocchino/sticky-pull-request-comment@v3 | ||
| uses: marocchino/sticky-pull-request-comment@70d2764d1a7d5d9560b100cbea0077fc8f633987 # v3.0.2 | ||
| with: | ||
| message: | | ||
| ## 🚀 Overture Maps docs branch preview deployed! | ||
| ## 🗺️ OMF Docs previews are live! | ||
|
|
||
| | | | | ||
| |-------------------------|----------------------------------------------------------------------| | ||
| | 🆕 **Auto-gen schema site (beta)** | ${{ env.STAGING_URL }}${{ env.PREVIEW_PATH }}/index.html | | ||
| | 🗂️ **Auto-gen schema ref** | [${{ steps.deploy-metadata.outputs.schema-ref-short }}@${{ steps.deploy-metadata.outputs.schema-short-sha }}](https://github.com/OvertureMaps/schema/commit/${{ needs.build-auto-gen.outputs.schema-sha }}) | | ||
| | 🌍 **Repo schema site** | ${{ env.STAGING_URL }}${{ env.PREVIEW_PATH_NO_AUTOGEN }}/index.html | | ||
| | 🕐 **Updated** | ${{ steps.deploy-metadata.outputs.time }} | | ||
| | 📝 **Commit** | [${{ steps.deploy-metadata.outputs.short-sha }}](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}) | | ||
|
|
||
| You can review your changes at https://staging.overturemaps.org/${{ github.event.repository.name }}/pr/${{ github.event.number }}/index.html | ||
| Auto-gen schema site is now available. This is an early preview of a future workflow where we will automatically generate and publish reference docs for the Overture Maps Format schema with every change to the schema repo. | ||
| The auto-gen schema site may contain incomplete or inaccurate information as we are still refining the generation process, so please compare against the repo schema site and refer to the linked commit for the most up-to-date source of truth. | ||
|
|
||
| --- | ||
| <sub>♻️ Last refreshed: ${{ steps.timestamp.outputs.time }}</sub> | ||
| > [!NOTE] | ||
| > ♻️ This preview updates automatically with each push to this PR. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| name: Staging Deploy Cleanup | ||
| run-name: ♻️ Clean up staging preview for PR #${{ github.event.number }} | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| cleanup: | ||
| name: Cleanup | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-slim | ||
lowlydba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| permissions: | ||
| id-token: write | ||
| env: | ||
| AWS_ROLE_ARN: arn:aws:iam::763944545891:role/pages-staging-oidc-overturemaps | ||
| AWS_REGION: us-west-2 | ||
|
|
||
| steps: | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v6 | ||
| with: | ||
| role-to-assume: ${{ env.AWS_ROLE_ARN }} | ||
| aws-region: ${{ env.AWS_REGION }} | ||
|
|
||
| # No flags to ignore "not found" errors, so we use "|| true" to prevent failure if the path doesn't exist | ||
| - name: Delete from S3 | ||
| run: | | ||
| aws s3 rm --recursive \ | ||
| s3://overture-managed-staging-usw2/gh-pages/${{ github.event.repository.name }}/pr/${{ github.event.number }}/ || true | ||
|
|
||
| - name: Bust the cache | ||
| run: | | ||
| aws cloudfront create-invalidation \ | ||
| --distribution-id E1KP2IN0H2RGGT \ | ||
| --paths "/${{ github.event.repository.name }}/pr/${{ github.event.number }}/*" || true | ||
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
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
File renamed without changes.
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.