Added auto deploy preview for exampleSite #1
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 preview | |
on: | |
release: | |
types: | |
- published | |
pull_request: | |
branches: | |
- "*" | |
env: | |
REPO_OWNER: "nginx" | |
REPO_NAME: "documentation" | |
jobs: | |
deploy-example-site: | |
uses: nginxinc/docs-actions/.github/workflows/docs-build-push.yml@9c59fab05a8131f4d691ba6ea2b6a119f3ef832a # v1.0.7 | |
with: | |
production_url_path: "" | |
preview_url_path: "${{ vars.PREVIEW_URL_PATH }}" | |
docs_source_path: "./exampleSite/public" | |
docs_build_path: "./exampleSite" | |
doc_type: "hugo" | |
environment: "preview" | |
force_hugo_theme_version: "" | |
auto_deploy_branch: "main" | |
auto_deploy_env: "prod" | |
secrets: | |
AZURE_CREDENTIALS: ${{secrets.AZURE_CREDENTIALS_DOCS}} | |
AZURE_KEY_VAULT: ${{secrets.AZURE_KEY_VAULT_DOCS}} | |
# deploy-documentation-site: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Trigger `Build and deploy` workflow in `documentation` repo | |
# run: | | |
# event_type="trigger-preview-build" | |
# environment="preview" | |
# theme_version="${{ github.head_ref || '' }}" # Will either be the branch name if triggered from pull request, or empty string (aka latest) if triggered from release | |
# 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/${REPO_OWNER}/${REPO_NAME}/dispatches" \ | |
# -d "{\"event_type\": \"$event_type\", \"client_payload\": {\"environment\": \"$environment\", \"hugo_theme_override\": \"$theme_version\"}}" | |
# - name: Get the most recent workflow id | |
# run: | | |
# pipeline_id=$(curl -L \ | |
# -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/${REPO_OWNER}/${REPO_NAME}/actions/runs?event=repository_dispatch" | \ | |
# jq '.workflow_runs[0].id') | |
# Get the commented URL | |
# Show a comment on the workflow for the URL |