|
1 | | -name: AsciiDoc Documentation |
2 | | - |
3 | | -on: |
4 | | - workflow_dispatch: |
5 | | - pull_request: |
6 | | - merge_group: |
7 | | - push: |
8 | | - branches: |
9 | | - - 'master' |
10 | | - tags: |
11 | | - - '[0-9]+.[0-9]+.[0-9]+*' |
12 | | - |
13 | | -jobs: |
14 | | - build-doc: |
15 | | - runs-on: ubuntu-latest |
16 | | - name: Build AsciiDoc documentation |
17 | | - steps: |
18 | | - - name: Checkout into ./repo |
19 | | - uses: actions/checkout@v4 |
20 | | - with: |
21 | | - path: repo |
22 | | - - name: Extract revision info |
23 | | - id: rev_info |
24 | | - run: | |
25 | | - cd repo |
26 | | - echo ::set-output name=date::$(git show -s --format=%ci ${{ github.sha }}) |
27 | | - REV_TAG=$(git tag --list '*.*.*' --points-at ${{ github.sha }}) |
28 | | - REV_VERSION=$(if [[ $REV_TAG ]]; then echo "$REV_TAG"; else echo "${{ github.sha }}"; fi) |
29 | | - echo ::set-output name=tag::"$REV_TAG" |
30 | | - echo ::set-output name=version::"$REV_VERSION" |
31 | | - cd .. |
32 | | - - name: Process AsciiDoc from ./repo to ./public |
33 | | - uses: tonynv/asciidoctor-action@v2 |
34 | | - with: |
35 | | - program: asciidoctor -D public -b html5 -o index.html -a toc=left -a revdate="${{ steps.rev_info.outputs.date }}" -a revnumber="${{ steps.rev_info.outputs.version }}" -a source-highlighter=rouge repo/README.adoc |
36 | | - - name: Upload AsciiDoc documentation |
37 | | - uses: actions/upload-artifact@v4 |
38 | | - with: |
39 | | - name: docs-${{ github.sha }} |
40 | | - path: public |
41 | | - retention-days: 3 |
42 | | - publish-doc: |
43 | | - runs-on: ubuntu-latest |
44 | | - name: Deploy to GitHub Pages |
45 | | - if: startsWith(github.event.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' |
46 | | - needs: build-doc |
47 | | - environment: github-pages-branch |
48 | | - steps: |
49 | | - - name: Download documentation artifact into ./public |
50 | | - uses: actions/download-artifact@v4 |
51 | | - with: |
52 | | - name: docs-${{ github.sha }} |
53 | | - path: public |
54 | | - - name: Push content of ./public |
55 | | - uses: peaceiris/actions-gh-pages@v3 |
56 | | - with: |
57 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
58 | | - publish_dir: public |
| 1 | +name: AsciiDoc Documentation |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + merge_group: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - 'master' |
| 10 | + tags: |
| 11 | + - '[0-9]+.[0-9]+.[0-9]+*' |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-doc: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + name: Build AsciiDoc documentation |
| 17 | + steps: |
| 18 | + - name: Checkout into ./repo |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + path: repo |
| 22 | + - name: Extract revision info |
| 23 | + id: rev_info |
| 24 | + run: | |
| 25 | + cd repo |
| 26 | + echo ::set-output name=date::$(git show -s --format=%ci ${{ github.sha }}) |
| 27 | + REV_TAG=$(git tag --list '*.*.*' --points-at ${{ github.sha }}) |
| 28 | + REV_VERSION=$(if [[ $REV_TAG ]]; then echo "$REV_TAG"; else echo "${{ github.sha }}"; fi) |
| 29 | + echo ::set-output name=tag::"$REV_TAG" |
| 30 | + echo ::set-output name=version::"$REV_VERSION" |
| 31 | + cd .. |
| 32 | + - name: Process AsciiDoc from ./repo to ./public |
| 33 | + uses: tonynv/asciidoctor-action@v2 |
| 34 | + with: |
| 35 | + program: asciidoctor -D public -b html5 -o index.html -a toc=left -a revdate="${{ steps.rev_info.outputs.date }}" -a revnumber="${{ steps.rev_info.outputs.version }}" -a source-highlighter=rouge repo/README.adoc |
| 36 | + - name: Upload AsciiDoc documentation |
| 37 | + uses: actions/upload-artifact@v4 |
| 38 | + with: |
| 39 | + name: docs-${{ github.sha }} |
| 40 | + path: public |
| 41 | + retention-days: 3 |
| 42 | + publish-doc: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + name: Deploy to GitHub Pages |
| 45 | + if: startsWith(github.event.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' |
| 46 | + needs: build-doc |
| 47 | + environment: github-pages-branch |
| 48 | + steps: |
| 49 | + - name: Download documentation artifact into ./public |
| 50 | + uses: actions/download-artifact@v4 |
| 51 | + with: |
| 52 | + name: docs-${{ github.sha }} |
| 53 | + path: public |
| 54 | + - name: Push content of ./public |
| 55 | + uses: peaceiris/actions-gh-pages@v4 |
| 56 | + with: |
| 57 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + publish_dir: public |
0 commit comments