|
46 | 46 |
|
47 | 47 | steps: |
48 | 48 | - name: Checkout project |
49 | | - uses: actions/checkout@v3 |
| 49 | + uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + fetch-depth: 0 |
50 | 52 |
|
51 | 53 | - name: Install system dependencies |
52 | 54 | run: | |
@@ -85,65 +87,35 @@ jobs: |
85 | 87 | cd build |
86 | 88 | make doc |
87 | 89 | cd .. |
88 | | - cp README.md CHANGELOG.md dist/ |
89 | | -
|
90 | | - - name: Upload documentation |
91 | | - if: "matrix.os == 'ubuntu-20.04'" |
92 | | - uses: actions/upload-artifact@v3 |
93 | | - with: |
94 | | - name: dist-cpp |
95 | | - path: dist/ |
96 | | - if-no-files-found: error |
97 | | - retention-days: 1 |
98 | | - |
99 | | - commit_documentation: |
100 | | - name: Add documentation into gh-pages branch |
101 | | - needs: build_and_test |
102 | | - if: "always()&&(needs.create_release.outputs.job_status=='success')&&(needs.build_and_test.outputs.job_status=='success')" |
103 | | - runs-on: ubuntu-latest |
104 | | - |
105 | | - steps: |
106 | | - |
107 | | - - name: Checkout project on gh-pages |
108 | | - uses: actions/checkout@v3 |
109 | | - with: |
110 | | - ref: 'gh-pages' |
111 | | - token: ${{ secrets.GITHUB_TOKEN }} |
112 | 90 |
|
113 | | - - uses: actions/download-artifact@v3 |
| 91 | + cp docs/mkdocs.yml target/mkdocs.yml |
| 92 | + cp -r docs/overrides target/ |
| 93 | + cp docs/documentation.md target/docs/documentation.md |
| 94 | + cp docs/README.hdr.md target/docs/README.md |
| 95 | + cp docs/CHANGELOG.hdr.md target/docs/CHANGELOG.md |
| 96 | + cp docs/CONTRIBUTING.hdr.md target/docs/CONTRIBUTING.md |
| 97 | + sed "s#x.y.z#${{ github.ref_name }}#g" README.md >>target/docs/README.md |
| 98 | + cat CHANGELOG.md >>target/docs/CHANGELOG.md |
| 99 | + cat CONTRIBUTING.md >>target/docs/CONTRIBUTING.md |
| 100 | +
|
| 101 | + - name: Setup python |
| 102 | + uses: actions/setup-python@v4 |
114 | 103 | with: |
115 | | - name: dist-cpp |
116 | | - path: artifact/ |
117 | | - |
118 | | - - name: Copy version elements to final location |
119 | | - run: | |
120 | | - mkdir -p docs/versions/${{ github.ref_name }} |
121 | | - cp -r artifact/html docs/versions/${{ github.ref_name }}/ |
122 | | -
|
123 | | - - name: Add pages from templates |
124 | | - run: | |
125 | | - sed "s#__version__#${{ github.ref_name }}#" templates/mkdocs.template.yml >mkdocs.yml |
| 104 | + python-version: "3.10" |
| 105 | + cache: 'pip' |
126 | 106 |
|
127 | | - sed "s#__version__#${{ github.ref_name }}#" templates/documentation.template.md >docs/versions/${{ github.ref_name }}/documentation.md |
| 107 | + - name: Install Mkdocs |
| 108 | + run: pip install -r docs/requirements.txt |
128 | 109 |
|
129 | | - sed "s#__version__#${{ github.ref_name }}#" templates/index-version.template.md >docs/versions/${{ github.ref_name }}/index.md |
130 | | - cat artifact/README.md >>docs/versions/${{ github.ref_name }}/index.md |
131 | | - sed -i "s#x.y.z#${{ github.ref_name }}#g" docs/versions/${{ github.ref_name }}/index.md |
132 | | -
|
133 | | -
|
134 | | - cp templates/index-versions.template.md docs/versions/index.md |
135 | | - sed "s/^## \(.*\)$/## \1 \n\n[➔ Lien vers la documentation](\1\/index.md) /" artifact/CHANGELOG.md >>docs/versions/index.md |
136 | | -
|
137 | | - sed "s#__version__#${{ github.ref_name }}#" templates/latest.template.html >docs/versions/latest/index.html |
138 | | - rm -r artifact |
139 | | -
|
140 | | - - name: Publish on gh-pages branch |
| 110 | + - name: Publish documentation |
| 111 | + if: "matrix.os == 'ubuntu-20.04'" |
141 | 112 | run: | |
142 | 113 | git config user.name github-actions |
143 | 114 | git config user.email github-actions@github.com |
144 | | - git add -v docs/versions/${{ github.ref_name }}/ docs/versions/latest/ docs/versions/index.md mkdocs.yml |
145 | | - git commit -m "Add documentation for version ${{ github.ref_name }}" |
146 | | - git push |
| 115 | + cd target/ |
| 116 | + mike deploy --push --update-aliases --branch gh-pages -t "Version ${{ github.ref_name }}" ${{ github.ref_name }} latest |
| 117 | + mike set-default --push --branch gh-pages ${{ github.ref_name }} |
| 118 | +
|
147 | 119 |
|
148 | 120 | delete_version: |
149 | 121 | name: Remove release and tag if error occured |
|
0 commit comments