Skip to content
25 changes: 23 additions & 2 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Build and deploy (docs)
on:
repository_dispatch:
types: [trigger-preview-build]
workflow_call:
inputs:
environment:
Expand Down Expand Up @@ -46,7 +48,7 @@ jobs:
steps:
- name: Output variables
run: |
echo "Environment: ${{ inputs.environment }}"
echo "Environment: ${{ inputs.environment || github.event.client_payload.environment }}"
echo "Branch: ${{ github.ref }}"
- name: Checks to see that main branch is selected if deploying to prod
if: ${{ inputs.environment == 'prod' && github.ref != 'refs/heads/main' }}
Expand All @@ -63,14 +65,33 @@ jobs:
docs_source_path: "public"
docs_build_path: "./"
doc_type: "hugo"
environment: ${{inputs.environment}}
environment: ${{ inputs.environment || github.event.client_payload.environment }}
force_hugo_theme_version: ${{inputs.hugo_theme_override}}
auto_deploy_branch: "main"
auto_deploy_env: "prod"
secrets:
AZURE_CREDENTIALS: ${{secrets.AZURE_CREDENTIALS_DOCS}}
AZURE_KEY_VAULT: ${{secrets.AZURE_KEY_VAULT_DOCS}}

trigger-theme-slack-notification:
if: github.event_name == 'repository_dispatch'
needs: call-docs-build-push
runs-on: ubuntu-latest
permissions: read-all
steps:
- name: Trigger 'Slack notification for new theme release' workflow in 'nginx-hugo-theme' repo.
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/nginxinc/nginx-hugo-theme/dispatches" \
-d "{"event_type": "trigger-slack-notification", "client_payload": {"previewURL": "${{PREVIEW_URL}}"}}"
env:
PREVIEW_URL: ${{ needs.call-docs-build-push.outputs.PREVIEW_URL }}


lighthouseci:
if: github.event.pull_request
needs: call-docs-build-push
Expand Down