-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (50 loc) · 1.55 KB
/
Copy pathdocs.yml
File metadata and controls
59 lines (50 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: docs
on:
pull_request:
paths-ignore:
- LICENSE
- README.*
- examples
push:
paths-ignore:
- LICENSE
- README.*
- examples
tags:
- '*.*.*'
branches:
- main
workflow_dispatch:
permissions:
contents: write
env:
nim-version: 'stable'
deploy-dir: .gh-pages
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compute package name
id: pkg
run: |
name="${GITHUB_REPOSITORY##*/}" # e.g. paypal-nim / paypal-api
name="${name%-nim}"
name="${name%-api}"
echo "pkg=${name}" >> "$GITHUB_OUTPUT" # e.g. paypal
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: ${{ env.nim-version }}
- run: nimble install -Y
- run: nim doc --index:on --project --path:. --out:${{ env.deploy-dir }} src/${{ steps.pkg.outputs.pkg }}.nim
- name: "Rename to index.html"
run: mv ${{ env.deploy-dir }}/${{ steps.pkg.outputs.pkg }}.html ${{ env.deploy-dir }}/index.html
- name: "Find and replace (index.html)"
run: sed -i 's/${{ steps.pkg.outputs.pkg }}.html/index.html/g' ${{ env.deploy-dir }}/index.html
- name: "Find and replace (theindex.html)"
run: sed -i 's/${{ steps.pkg.outputs.pkg }}.html/index.html/g' ${{ env.deploy-dir }}/theindex.html
- name: Deploy documents
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.deploy-dir }}