Skip to content

Commit 4e19890

Browse files
NomakCooperpatchback[bot]
authored andcommitted
add docsite workflow (#112)
(cherry picked from commit ee89dbf)
1 parent c7c465b commit 4e19890

3 files changed

Lines changed: 154 additions & 0 deletions

File tree

.github/workflows/docs-pr.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
# Copyright (c) Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
name: Collection Docs PR
7+
concurrency:
8+
group: docs-pr-${{ github.head_ref }}
9+
cancel-in-progress: true
10+
on:
11+
pull_request_target:
12+
types: [opened, synchronize, reopened, closed]
13+
14+
env:
15+
GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
16+
17+
jobs:
18+
build-docs:
19+
permissions:
20+
contents: read
21+
name: Build Ansible Docs
22+
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-pr.yml@main
23+
with:
24+
collection-name: ans2dev.general
25+
init-lenient: false
26+
init-fail-on-error: true
27+
squash-hierarchy: true
28+
init-project: ans2dev.general Collection
29+
init-copyright: 3A2DEV Contributors
30+
init-title: ans2dev.general Collection Documentation
31+
init-html-short-title: ans2dev.general Collection Docs
32+
init-extra-html-theme-options: |
33+
documentation_home_url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/branch/main/
34+
render-file-line: '> * `$<status>` [$<path_tail>](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr/${{ github.event.number }}/$<path_tail>)'
35+
36+
publish-docs-gh-pages:
37+
# for now we won't run this on forks
38+
if: github.repository == '3A2DEV/ans2dev.general'
39+
permissions:
40+
contents: write
41+
pages: write
42+
id-token: write
43+
needs: [build-docs]
44+
name: Publish Ansible Docs
45+
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main
46+
with:
47+
artifact-name: ${{ needs.build-docs.outputs.artifact-name }}
48+
action: ${{ (github.event.action == 'closed' || needs.build-docs.outputs.changed != 'true') && 'teardown' || 'publish' }}
49+
publish-gh-pages-branch: true
50+
secrets:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
comment:
54+
permissions:
55+
pull-requests: write
56+
runs-on: ubuntu-latest
57+
needs: [build-docs, publish-docs-gh-pages]
58+
name: PR comments
59+
steps:
60+
- name: PR comment
61+
uses: ansible-community/github-docs-build/actions/ansible-docs-build-comment@main
62+
with:
63+
body-includes: '## Docs Build'
64+
reactions: heart
65+
action: ${{ needs.build-docs.outputs.changed != 'true' && 'remove' || '' }}
66+
on-closed-body: |
67+
## Docs Build 📝
68+
69+
This PR is closed and any previously published docsite has been unpublished.
70+
on-merged-body: |
71+
## Docs Build 📝
72+
73+
Thank you for contribution!✨
74+
75+
This PR has been merged and the docs are now incorporated into `main`:
76+
${{ env.GHP_BASE_URL }}/branch/main
77+
body: |
78+
## Docs Build 📝
79+
80+
Thank you for contribution!✨
81+
82+
The docs for **this PR** have been published here:
83+
${{ env.GHP_BASE_URL }}/pr/${{ github.event.number }}
84+
85+
You can compare to the docs for the `main` branch here:
86+
${{ env.GHP_BASE_URL }}/branch/main
87+
88+
The docsite for **this PR** is also available for download as an artifact from this run:
89+
${{ needs.build-docs.outputs.artifact-url }}
90+
91+
File changes:
92+
93+
${{ needs.build-docs.outputs.diff-files-rendered }}
94+
95+
${{ needs.build-docs.outputs.diff-rendered }}

.github/workflows/docs-push.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
# Copyright (c) Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
name: Collection Docs Push
7+
concurrency:
8+
group: docs-push-${{ github.sha }}
9+
cancel-in-progress: true
10+
on:
11+
push:
12+
branches:
13+
- main
14+
- stable-*
15+
tags:
16+
- '*'
17+
# Run CI once per day (at 09:00 UTC)
18+
schedule:
19+
- cron: '0 9 * * *'
20+
# Allow manual trigger (for newer antsibull-docs, sphinx-ansible-theme, ... versions)
21+
workflow_dispatch:
22+
23+
jobs:
24+
build-docs:
25+
permissions:
26+
contents: read
27+
name: Build Ansible Docs
28+
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-push.yml@main
29+
with:
30+
collection-name: ans2dev.general
31+
init-lenient: false
32+
init-fail-on-error: true
33+
squash-hierarchy: true
34+
init-project: ans2dev.general Collection
35+
init-copyright: 3A2DEV Contributors
36+
init-title: ans2dev.general Collection Documentation
37+
init-html-short-title: ans2dev.general Collection Docs
38+
init-extra-html-theme-options: |
39+
documentation_home_url=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/branch/main/
40+
41+
publish-docs-gh-pages:
42+
# for now we won't run this on forks
43+
if: github.repository == '3A2DEV/ans2dev.general'
44+
permissions:
45+
contents: write
46+
pages: write
47+
id-token: write
48+
needs: [build-docs]
49+
name: Publish Ansible Docs
50+
uses: ansible-community/github-docs-build/.github/workflows/_shared-docs-build-publish-gh-pages.yml@main
51+
with:
52+
artifact-name: ${{ needs.build-docs.outputs.artifact-name }}
53+
publish-gh-pages-branch: true
54+
secrets:
55+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Copyright (c) Ansible Project
2+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
15
/tests/output/
26
/changelogs/.plugin-cache.yaml
37

0 commit comments

Comments
 (0)