From 42c93648d2f43a84745c199d134e9ed934af520f Mon Sep 17 00:00:00 2001 From: George Lemon Date: Tue, 22 Aug 2023 22:39:54 +0300 Subject: [PATCH] Create docs.yml --- .github/workflows/docs.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..eb7b64f --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,39 @@ +name: docs +on: + push: + tags: + - '*.*.*' + # branches: + # - main +env: + nim-version: 'stable' + nim-src: src/${{ github.event.repository.name }}.nim + deploy-dir: .gh-pages +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - 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 }} ${{ env.nim-src }} + + - name: "Rename to index.html" + run: mv ${{ env.deploy-dir }}/${{ github.event.repository.name }}.html ${{ env.deploy-dir }}/index.html + + - name: "Find and replace (index.html)" + run: sed -i 's/${{ github.event.repository.name }}.html/index.html/g' ${{ env.deploy-dir }}/index.html + + # - name: "Find and replace (idx)" + # run: sed -i 's/${{ github.event.repository.name }}.html/index.html/g' ${{ env.deploy-dir }}/${{ github.event.repository.name }}.idx + + - name: "Find and replace (theindex.html)" + run: sed -i 's/${{ github.event.repository.name }}.html/index.html/g' ${{ env.deploy-dir }}/theindex.html + + - name: Deploy documents + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ${{ env.deploy-dir }}