|
| 1 | +name: Build and Deploy API Documentation |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - adam/371_docs_workflow |
| 7 | + # tags: |
| 8 | + # - '[0-9]+\.[0-9]+\.[0-9]' |
| 9 | + # - '![0-9]+\.[0-9]+\.[0-9]-[a-z]*' |
| 10 | + # - '![0-9]+\.[0-9]+\.[0-9]-[A-Z]*' |
| 11 | + |
| 12 | +jobs: |
| 13 | + generate_docs: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + - name: Set up JDK |
| 24 | + uses: actions/setup-java@v3 |
| 25 | + with: |
| 26 | + distribution: 'temurin' |
| 27 | + java-version: '17' |
| 28 | + - name: Copy docs to docs/dokka directory |
| 29 | + run: | |
| 30 | + # git fetch origin docs:docs |
| 31 | + git fetch origin adam/only_docs:adam/only_docs |
| 32 | + # git checkout docs |
| 33 | + git checkout adam/only_docs |
| 34 | + mkdir -p docs/dokka || true |
| 35 | + cp -R current/ docs/dokka/current |
| 36 | + cp -R history/ docs/dokka/history |
| 37 | + # git checkout ${{ github.ref_name }} |
| 38 | + git checkout adam/371_docs_workflow |
| 39 | + - name: Generate Dokka Documentation |
| 40 | + run: ./gradlew dokkaHtmlMultiModule |
| 41 | + - name: Update Docs Branch |
| 42 | + run: | |
| 43 | + TAG=$(git describe --tags --abbrev=0) |
| 44 | + # git checkout docs |
| 45 | + git checkout adam/only_docs |
| 46 | + cp -R docs/dokka/history . |
| 47 | + cp -R docs/dokka/current . |
| 48 | + git add history |
| 49 | + git add current |
| 50 | + git fetch --tags |
| 51 | + git config user.name github-actions |
| 52 | + git config user.email [email protected] |
| 53 | + # git commit -m "Update API documentation for ${{ github.ref_name }}" |
| 54 | + git commit -m "Update API documentation for $TAG" |
| 55 | + # git push origin docs |
| 56 | + git push origin adam/only_docs |
0 commit comments