CI: publish documentation for tagged commits.
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 20:42:21 +0000 (20:42 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 20:42:21 +0000 (20:42 +0000)
.github/workflows/main.yaml

index bf57e332ad0b7b5dea3d7fdd7d271e25830dffc9..f8601b65ab96ab339f1230364d4f9857bd18b061 100644 (file)
@@ -55,11 +55,24 @@ jobs:
       - name: Build documentation
         run: |
           sphinx-build docs docs/_build
-      - name: Publish documentation
-        if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
-        uses: JamesIves/github-pages-deploy-action@releases/v3
+      - name: Publish development documentation
+        if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
+        uses: JamesIves/github-pages-deploy-action@releases/v4
         with:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          BRANCH: gh-pages
-          FOLDER: docs/_build
-          TARGET_FOLDER: latest/
+          repository-name: nmigen/nmigen.github.io
+          ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }}
+          branch: main
+          folder: docs/_build
+          target-folder: docs/nmigen/latest/
+      - name: Extract release version
+        if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
+        run: echo "VERSION=$(python setup.py --version)" >>$GITHUB_ENV
+      - name: Publish release documentation
+        if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
+        uses: JamesIves/github-pages-deploy-action@releases/v4
+        with:
+          repository-name: nmigen/nmigen.github.io
+          ssh-key: ${{ secrets.PAGES_DEPLOY_KEY }}
+          branch: main
+          folder: docs/_build
+          target-folder: docs/nmigen/v${{ env.VERSION }}/