fixed image filename references broken by casing #29
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
| name: Build and deploy Docusaurus site to Azure Blob Storage | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop # Add your development branch here | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to deploy to' | |
| required: true | |
| default: 'development' | |
| type: choice | |
| options: | |
| - development | |
| - production | |
| jobs: | |
| determine-environment: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| environment: ${{ steps.set-env.outputs.environment }} | |
| steps: | |
| - name: Determine environment | |
| id: set-env | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "environment=${{ github.event.inputs.environment }}" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| echo "environment=production" >> $GITHUB_OUTPUT | |
| else | |
| echo "environment=development" >> $GITHUB_OUTPUT | |
| fi | |
| build: | |
| runs-on: self-hosted | |
| needs: determine-environment | |
| environment: ${{ needs.determine-environment.outputs.environment }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check out source code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '22.x' | |
| - name: Cache Node.js dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install dependencies and build site | |
| run: | | |
| npm ci | |
| npm run build | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=16384" | |
| DOCUSAURUS_URL: "https://${{ secrets.STORAGE_ACCOUNT_NAME }}.z13.web.core.windows.net" | |
| # Add any other environment-specific build variables here | |
| NODE_ENV: ${{ needs.determine-environment.outputs.environment }} | |
| - name: Upload artifact for deployment | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-output | |
| path: build/ | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: [build, determine-environment] | |
| environment: ${{ needs.determine-environment.outputs.environment }} | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-output | |
| path: build/ | |
| # Azure login step removed - using storage account key instead | |
| - name: Upload to Azure Blob Storage | |
| run: | | |
| echo "Deploying to ${{ needs.determine-environment.outputs.environment }} environment" | |
| # Upload all files to the $web container using storage account key | |
| az storage blob upload-batch \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --destination '$web' \ | |
| --source ./build \ | |
| --overwrite | |
| - name: Set blob content types | |
| run: | | |
| # Set correct content types for common web files | |
| az storage blob list \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --query "[?ends_with(name, '.html')].name" \ | |
| --output tsv | while read -r blob; do | |
| az storage blob update \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --name "$blob" \ | |
| --content-type "text/html" | |
| done | |
| az storage blob list \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --query "[?ends_with(name, '.css')].name" \ | |
| --output tsv | while read -r blob; do | |
| az storage blob update \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --name "$blob" \ | |
| --content-type "text/css" | |
| done | |
| az storage blob list \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --query "[?ends_with(name, '.js')].name" \ | |
| --output tsv | while read -r blob; do | |
| az storage blob update \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --name "$blob" \ | |
| --content-type "application/javascript" | |
| done | |
| # Set content types for other common file types | |
| az storage blob list \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --query "[?ends_with(name, '.json')].name" \ | |
| --output tsv | while read -r blob; do | |
| az storage blob update \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --name "$blob" \ | |
| --content-type "application/json" | |
| done | |
| az storage blob list \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --query "[?ends_with(name, '.svg')].name" \ | |
| --output tsv | while read -r blob; do | |
| az storage blob update \ | |
| --account-name ${{ secrets.STORAGE_ACCOUNT_NAME }} \ | |
| --account-key ${{ secrets.STORAGE_ACCOUNT_KEY }} \ | |
| --container-name '$web' \ | |
| --name "$blob" \ | |
| --content-type "image/svg+xml" | |
| done | |
| - name: Display deployment URL | |
| run: | | |
| echo "🚀 Deployment complete!" | |
| echo "Environment: ${{ needs.determine-environment.outputs.environment }}" | |
| echo "URL: https://${{ secrets.STORAGE_ACCOUNT_NAME }}.z13.web.core.windows.net" | |
| if [[ -n "${{ secrets.CUSTOM_DOMAIN }}" ]]; then | |
| echo "Custom Domain: ${{ secrets.CUSTOM_DOMAIN }}" | |
| fi |