From 4eeb4ee0cac2be214fcda8acd9844e59b8c56fdc Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Thu, 15 May 2025 10:03:59 -0700 Subject: [PATCH 1/2] Action: Added preview to exampleSite --- .github/workflows/build-push.yml | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/build-push.yml diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml new file mode 100644 index 0000000..4c089df --- /dev/null +++ b/.github/workflows/build-push.yml @@ -0,0 +1,59 @@ +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: "/nginx-hugo-theme" + preview_url_path: "/previews/nginx-hugo-theme" + docs_source_path: "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 \ No newline at end of file From 57e8981684ab8a4b980d2f92014b0bd47d7e7f6a Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Thu, 15 May 2025 11:19:59 -0700 Subject: [PATCH 2/2] Action: Remove unneeded code --- .github/workflows/build-push.yml | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 4c089df..c7fa281 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -27,33 +27,4 @@ jobs: 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 \ No newline at end of file + AZURE_KEY_VAULT: ${{secrets.AZURE_KEY_VAULT_DOCS}} \ No newline at end of file