|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + BRANCH_NAME: |
| 7 | + description: The branch to work with |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + prepare: |
| 12 | + name: Prepare |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + tag_name: v${{ inputs.BRANCH_NAME }} |
| 16 | + steps: |
| 17 | + - run: exit 0 |
| 18 | + |
| 19 | + tag: |
| 20 | + name: Tag and delete branch |
| 21 | + runs-on: ubuntu-latest |
| 22 | + needs: prepare |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v5 |
| 25 | + with: |
| 26 | + ref: ${{ inputs.BRANCH_NAME }} |
| 27 | + fetch-depth: 0 |
| 28 | + |
| 29 | + - name: Tag `${{ inputs.BRANCH_NAME }}` as `${{ needs.prepare.outputs.tag_name }}` |
| 30 | + run: | |
| 31 | + git tag ${{ needs.prepare.outputs.tag_name }} origin/${{ inputs.BRANCH_NAME }} |
| 32 | + git push origin ${{ needs.prepare.outputs.tag_name }} |
| 33 | +
|
| 34 | + - name: Delete `${{ inputs.BRANCH_NAME }}` |
| 35 | + run: | |
| 36 | + git push origin --delete ${{ inputs.BRANCH_NAME }} |
| 37 | +
|
| 38 | + pages: |
| 39 | + name: Publish docs |
| 40 | + runs-on: ubuntu-latest |
| 41 | + needs: |
| 42 | + - tag |
| 43 | + - prepare |
| 44 | + env: |
| 45 | + GH_PAGES_BRANCH: gh-pages |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v5 |
| 48 | + with: |
| 49 | + path: repo |
| 50 | + ref: ${{ needs.prepare.outputs.tag_name }} |
| 51 | + |
| 52 | + - uses: actions/checkout@v5 |
| 53 | + with: |
| 54 | + ref: ${{ env.GH_PAGES_BRANCH}} |
| 55 | + path: ${{ env.GH_PAGES_BRANCH}} |
| 56 | + |
| 57 | + - name: Install Doxygen |
| 58 | + run: | |
| 59 | + sudo apt-get update |
| 60 | + sudo apt-get install -y doxygen |
| 61 | +
|
| 62 | + - name: Generate Doxygen documentation |
| 63 | + working-directory: repo |
| 64 | + run: | |
| 65 | + doxygen |
| 66 | +
|
| 67 | + - name: Post-process docs |
| 68 | + run: | |
| 69 | + mv repo/docs/html ${GH_PAGES_BRANCH}/${{ inputs.BRANCH_NAME }} |
| 70 | +
|
| 71 | + # doc-index.html |
| 72 | + sed -i \ |
| 73 | + "/Development Branch/a\<li><a href=\"https://github.com/${GITHUB_REPOSITORY}/blob/${{ needs.prepare.outputs.tag_name }}/Reference_Manual.md\">${{ inputs.BRANCH_NAME }}</a></li>" \ |
| 74 | + "${GH_PAGES_BRANCH}/doc-index.html" |
| 75 | +
|
| 76 | + # api-index.html |
| 77 | + sed -i \ |
| 78 | + "/<ul>/a\ <li><a href=\"${{ inputs.BRANCH_NAME }}/index.html\">${{ inputs.BRANCH_NAME }}</a></li>" \ |
| 79 | + "${GH_PAGES_BRANCH}/api-index.html" |
| 80 | +
|
| 81 | + - name: Create Pull Request |
| 82 | + uses: peter-evans/create-pull-request@v7 |
| 83 | + with: |
| 84 | + branch: ${{ needs.prepare.outputs.tag_name }}_doc_update_run_${{ github.run_id }} |
| 85 | + title: Add the new C++ client release (`${{ needs.prepare.outputs.tag_name }}`) documentation |
| 86 | + body: "" |
| 87 | + path: ${{ env.GH_PAGES_BRANCH}} |
0 commit comments