Publish module index #11
This file contains 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 publishes the list of all public bicep modules to an index file that the Bicep vscode extension can read for intellisense | |
# and also a human-readable HTML version. | |
name: Publish module index | |
on: | |
schedule: | |
- cron: 45 11 * * * # Run daily at 3:45 AM PST | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
pages: write | |
contents: read | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
upload-index-data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 // Needed to fetch all history and tags | |
- name: Install packages | |
run: npm ci | |
- name: Generate moduleIndex.json | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const script = require("./scripts/github-actions/generate-module-index-data.js") | |
await script({ require, github, context, core }) | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: moduleIndex.json | |
path: moduleIndex.json | |
- name: Log in to Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.PUBLISH_CLIENT_ID }} | |
tenant-id: ${{ secrets.PUBLISH_TENANT_ID }} | |
subscription-id: ${{ secrets.PUBLISH_SUBSCRIPTION_ID }} | |
- name: Upload to blob storage | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az storage blob upload --account-name biceplivedatasaprod --container-name bicep-cdn-live-data-container --name module-index --file moduleIndex.json --auth-mode login --overwrite | |
build-index-page: | |
runs-on: ubuntu-latest | |
needs: upload-index-data | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install packages | |
run: npm ci | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: moduleIndex.json | |
- name: Generate index.md | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const script = require("./scripts/github-actions/generate-module-index-md.js") | |
await script({ require, github, context, core }) | |
- name: Upload Markdown artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ./docs/jekyll/index.md | |
name: index.md | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.1" | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
working-directory: ./docs/jekyll | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v3 | |
- name: Build with Jekyll | |
working-directory: ./docs/jekyll | |
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" # Outputs to the './_site' directory by default | |
env: | |
JEKYLL_ENV: production | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./docs/jekyll/_site | |
deploy-index-page: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build-index-page | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |