| 1 |
name: Collection Docs |
| 2 |
concurrency: |
| 3 |
group: docs-pr-${{ github.head_ref }} |
| 4 |
cancel-in-progress: true |
| 5 |
on: |
| 6 |
pull_request_target: |
| 7 |
types: [opened, synchronize, reopened, closed] |
| 8 |
|
| 9 |
env: |
| 10 |
SURGE_PR_SITE: community-hashi-vault-pr${{ github.event.number }}.surge.sh |
| 11 |
SURGE_MAIN_SITE: community-hashi-vault-main.surge.sh |
| 12 |
GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }} |
| 13 |
|
| 14 |
jobs: |
| 15 |
# this job builds with the most strict options to ensure full compliance |
| 16 |
# does not use the collection's committed sphinx-init output |
| 17 |
validate-docs: |
| 18 |
permissions: |
| 19 |
contents: read |
| 20 |
name: Validate Ansible Docs |
| 21 |
if: github.event.action != 'closed' |
| 22 |
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-push.yml@main |
| 23 |
with: |
| 24 |
artifact-upload: false |
| 25 |
init-lenient: false |
| 26 |
init-fail-on-error: true |
| 27 |
build-ref: refs/pull/${{ github.event.number }}/merge |
| 28 |
|
| 29 |
# this job builds for the PR comparison and publish, so use the most lenient options |
| 30 |
# to give the best possibility of producing a publishable build; the strict build will |
| 31 |
# still result in a failure for the PR as a whole, but for review a partial docsite is |
| 32 |
# better than none. |
| 33 |
# This uses the committed sphinx-init output which already has the lenient options. |
| 34 |
build-docs: |
| 35 |
permissions: |
| 36 |
contents: read |
| 37 |
name: Build Ansible Docs |
| 38 |
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-pr.yml@main |
| 39 |
with: |
| 40 |
init-dest-dir: docs/preview |
| 41 |
render-file-line: '> * `$<status>` [$<path_tail>](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr/${{ github.event.number }}/$<path_tail>)' |
| 42 |
|
| 43 |
# publish-docs-surge: |
| 44 |
# # for now we won't run this on forks |
| 45 |
# if: github.repository == 'ansible-collections/community.hashi_vault' |
| 46 |
# permissions: |
| 47 |
# contents: read |
| 48 |
# needs: [build-docs] |
| 49 |
# name: Publish Ansible Docs |
| 50 |
# uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-surge.yml@main |
| 51 |
# with: |
| 52 |
# artifact-name: ${{ needs.build-docs.outputs.artifact-name }} |
| 53 |
# surge-site-name: community-hashi-vault-pr${{ github.event.number }}.surge.sh |
| 54 |
# action: ${{ (github.event.action == 'closed' || needs.build-docs.outputs.changed != 'true') && 'teardown' || 'publish' }} |
| 55 |
# secrets: |
| 56 |
# SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} |
| 57 |
|
| 58 |
publish-docs-gh-pages: |
| 59 |
# for now we won't run this on forks |
| 60 |
if: github.repository == 'ansible-collections/community.hashi_vault' |
| 61 |
permissions: |
| 62 |
contents: write |
| 63 |
pages: write |
| 64 |
id-token: write |
| 65 |
needs: [build-docs] |
| 66 |
name: Publish Ansible Docs |
| 67 |
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main |
| 68 |
with: |
| 69 |
artifact-name: ${{ needs.build-docs.outputs.artifact-name }} |
| 70 |
action: ${{ (github.event.action == 'closed' || needs.build-docs.outputs.changed != 'true') && 'teardown' || 'publish' }} |
| 71 |
secrets: |
| 72 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 |
|
| 74 |
comment: |
| 75 |
permissions: |
| 76 |
pull-requests: write |
| 77 |
runs-on: ubuntu-latest |
| 78 |
needs: [build-docs, publish-docs-gh-pages] |
| 79 |
name: PR comments |
| 80 |
steps: |
| 81 |
- name: PR comment |
| 82 |
env: |
| 83 |
PR_SITE_URL: https://${{ env.SURGE_PR_SITE }} |
| 84 |
MAIN_SITE_URL: https://${{ env.SURGE_MAIN_SITE }} |
| 85 |
uses: ansible-community/github-docs-build/actions/ansible-docs-build-comment@main |
| 86 |
with: |
| 87 |
body-includes: '## Docs Build' |
| 88 |
reactions: heart |
| 89 |
action: ${{ needs.build-docs.outputs.changed != 'true' && 'remove' || '' }} |
| 90 |
on-closed-body: | |
| 91 |
## Docs Build 📝 |
| 92 |
|
| 93 |
This PR is closed and any previously published docsite has been unpublished. |
| 94 |
on-merged-body: | |
| 95 |
## Docs Build 📝 |
| 96 |
|
| 97 |
Thank you for contribution!✨ |
| 98 |
|
| 99 |
This PR has been merged and the docs are now incorporated into `main`: |
| 100 |
${{ env.GHP_BASE_URL }}/branch/main |
| 101 |
body: | |
| 102 |
## Docs Build 📝 |
| 103 |
|
| 104 |
Thank you for contribution!✨ |
| 105 |
|
| 106 |
The docs for **this PR** have been published here: |
| 107 |
${{ env.GHP_BASE_URL }}/pr/${{ github.event.number }} |
| 108 |
|
| 109 |
You can compare to the docs for the `main` branch here: |
| 110 |
${{ env.GHP_BASE_URL }}/branch/main |
| 111 |
|
| 112 |
The docsite for **this PR** is also available for download as an artifact from this run: |
| 113 |
${{ needs.build-docs.outputs.artifact-url }} |
| 114 |
|
| 115 |
File changes: |
| 116 |
|
| 117 |
${{ needs.build-docs.outputs.diff-files-rendered }} |
| 118 |
|
| 119 |
${{ needs.build-docs.outputs.diff-rendered }} |