|
| 1 | +name: GitHub Pages |
| 2 | + |
| 3 | +# Publishes the static landing page at https://azure-samples.github.io/Apim-Samples/ |
| 4 | +# The site source lives in /docs and pulls images from /assets at build time. |
| 5 | +# See docs/README.md for local preview instructions and the upkeep checklist. |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + push: |
| 10 | + branches: [ main ] |
| 11 | + paths: |
| 12 | + # Only rebuild when something that actually lands on the page changes. |
| 13 | + - 'docs/**' |
| 14 | + - 'assets/APIM-Samples.png' |
| 15 | + - 'assets/APIM-Samples-Slide-Deck.html' |
| 16 | + - 'assets/favicon-*.png' |
| 17 | + - 'assets/apple-touch-icon.png' |
| 18 | + - 'assets/android-chrome-*.png' |
| 19 | + - 'assets/site.webmanifest' |
| 20 | + - 'assets/diagrams/*.svg' |
| 21 | + - 'setup/export_presentation.py' |
| 22 | + - '.github/workflows/github-pages.yml' |
| 23 | + |
| 24 | +# Top-level default is read-only. The deploy job elevates only what GitHub |
| 25 | +# Pages needs (pages:write + id-token:write for the OIDC deploy token). |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +# Only one Pages deployment at a time. Newer pushes supersede in-flight ones, |
| 30 | +# but do not cancel a deploy that is already rolling out. |
| 31 | +concurrency: |
| 32 | + group: github-pages |
| 33 | + cancel-in-progress: false |
| 34 | + |
| 35 | +jobs: |
| 36 | + build: |
| 37 | + name: Build site |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - name: Checkout code |
| 41 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 42 | + with: |
| 43 | + persist-credentials: false |
| 44 | + |
| 45 | + - name: Configure Pages |
| 46 | + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 |
| 47 | + |
| 48 | + # Build the self-contained slide deck (all images inlined) so it can be |
| 49 | + # served as a single file at /slide-deck.html. The export script is |
| 50 | + # stdlib-only, so the runner's pre-installed Python is sufficient. |
| 51 | + - name: Export self-contained slide deck |
| 52 | + run: python3 setup/export_presentation.py |
| 53 | + |
| 54 | + # The HTML references images at ./assets/... — stage them next to |
| 55 | + # index.html so the uploaded artifact is entirely self-contained. |
| 56 | + # Diagram SVGs are renamed to short, URL-safe slugs in the process. |
| 57 | + - name: Stage site artifact |
| 58 | + run: | |
| 59 | + set -euo pipefail |
| 60 | +
|
| 61 | + mkdir -p _site/assets/diagrams |
| 62 | +
|
| 63 | + cp docs/index.html _site/index.html |
| 64 | + cp docs/styles.css _site/styles.css |
| 65 | + cp docs/robots.txt _site/robots.txt |
| 66 | + cp docs/sitemap.xml _site/sitemap.xml |
| 67 | +
|
| 68 | + # Self-contained slide deck (built by the previous step) |
| 69 | + cp build/APIM-Samples-Slide-Deck.html _site/slide-deck.html |
| 70 | +
|
| 71 | + # Brand assets |
| 72 | + cp assets/APIM-Samples.png _site/assets/apim-samples-logo.png |
| 73 | +
|
| 74 | + # Favicon set + web app manifest. All six land flat in _site/assets/ |
| 75 | + # because site.webmanifest resolves its icon src paths relative to |
| 76 | + # the manifest URL, not the page -- the android-chrome PNGs must be |
| 77 | + # siblings of the manifest file. |
| 78 | + cp assets/apple-touch-icon.png _site/assets/apple-touch-icon.png |
| 79 | + cp assets/favicon-32x32.png _site/assets/favicon-32x32.png |
| 80 | + cp assets/favicon-16x16.png _site/assets/favicon-16x16.png |
| 81 | + cp assets/site.webmanifest _site/assets/site.webmanifest |
| 82 | + cp assets/android-chrome-192x192.png _site/assets/android-chrome-192x192.png |
| 83 | + cp assets/android-chrome-512x512.png _site/assets/android-chrome-512x512.png |
| 84 | +
|
| 85 | + # Architecture diagrams (slugified -> matches <img src> in index.html) |
| 86 | + cp "assets/diagrams/Simple API Management Architecture.svg" \ |
| 87 | + _site/assets/diagrams/simple-apim.svg |
| 88 | + cp "assets/diagrams/API Management & Container Apps Architecture.svg" \ |
| 89 | + _site/assets/diagrams/apim-aca.svg |
| 90 | + cp "assets/diagrams/Azure Front Door, API Management & Container Apps Architecture.svg" \ |
| 91 | + _site/assets/diagrams/afd-apim-pe.svg |
| 92 | + cp "assets/diagrams/Azure Application Gateway, API Management & Container Apps Architecture.svg" \ |
| 93 | + _site/assets/diagrams/appgw-apim-pe.svg |
| 94 | + cp "assets/diagrams/Azure Application Gateway, API Management & Container Apps Architecture VNet.svg" \ |
| 95 | + _site/assets/diagrams/appgw-apim.svg |
| 96 | +
|
| 97 | + # github.io does not need Jekyll processing for a plain HTML site. |
| 98 | + touch _site/.nojekyll |
| 99 | +
|
| 100 | + echo "Staged artifact contents:" |
| 101 | + find _site -type f -printf ' %p\n' |
| 102 | +
|
| 103 | + - name: Upload Pages artifact |
| 104 | + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 |
| 105 | + with: |
| 106 | + path: _site |
| 107 | + |
| 108 | + deploy: |
| 109 | + name: Deploy site |
| 110 | + needs: build |
| 111 | + runs-on: ubuntu-latest |
| 112 | + permissions: |
| 113 | + pages: write # to push to the Pages deployment |
| 114 | + id-token: write # to mint the OIDC token actions/deploy-pages needs |
| 115 | + environment: |
| 116 | + name: github-pages |
| 117 | + url: ${{ steps.deployment.outputs.page_url }} |
| 118 | + steps: |
| 119 | + - name: Deploy to GitHub Pages |
| 120 | + id: deployment |
| 121 | + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |
0 commit comments