|
| 1 | +name: 📖 Deploy Documentation |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + releaseversion: |
| 7 | + description: 'Release version' |
| 8 | + required: true |
| 9 | + default: '3.0.0' |
| 10 | + copyDocsToCurrent: |
| 11 | + description: "Should the docs be published at https://docs.spring-boot-admin.com? Otherwise they will be accessible by version number only." |
| 12 | + required: true |
| 13 | + type: boolean |
| 14 | + default: false |
| 15 | +env: |
| 16 | + VERSION: ${{ github.event.inputs.releaseversion }} |
| 17 | + |
| 18 | +jobs: |
| 19 | + deploy-documentation: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up JDK 17 |
| 26 | + uses: actions/setup-java@v4 |
| 27 | + with: |
| 28 | + distribution: 'temurin' |
| 29 | + java-version: '17' |
| 30 | + cache: 'maven' |
| 31 | + |
| 32 | + - name: Cache node modules |
| 33 | + uses: actions/cache@v4 |
| 34 | + env: |
| 35 | + cache-name: cache-node-modules |
| 36 | + with: |
| 37 | + path: ~/.npm |
| 38 | + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} |
| 39 | + restore-keys: | |
| 40 | + ${{ runner.os }}-build-${{ env.cache-name }}- |
| 41 | + ${{ runner.os }}-build- |
| 42 | + ${{ runner.os }}- |
| 43 | +
|
| 44 | + - name: Set projects Maven version to GitHub Action GUI set version |
| 45 | + run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress |
| 46 | + |
| 47 | + - name: Build with Maven |
| 48 | + run: mvn -B --no-transfer-progress install -DskipTests |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + |
| 52 | + - name: Deploy documentation to GitHub Pages for version ${{ github.event.inputs.releaseversion }} |
| 53 | + |
| 54 | + with: |
| 55 | + branch: gh-pages |
| 56 | + folder: spring-boot-admin-docs/target/generated-docs |
| 57 | + target-folder: ${{ github.event.inputs.releaseversion }} |
| 58 | + clean: true |
| 59 | + |
| 60 | + - name: Deploy redirect for /current to /${{ github.event.inputs.releaseversion }} |
| 61 | + |
| 62 | + if: github.event.inputs.copyDocsToCurrent == 'true' |
| 63 | + with: |
| 64 | + branch: gh-pages |
| 65 | + folder: spring-boot-admin-docs/target/generated-docs/current |
| 66 | + target-folder: /current |
| 67 | + clean: true |
| 68 | + |
| 69 | + - name: Deploy deeplink redirect for /current/* to /${{ github.event.inputs.releaseversion }}/* |
| 70 | + |
| 71 | + if: github.event.inputs.copyDocsToCurrent == 'true' |
| 72 | + with: |
| 73 | + branch: gh-pages |
| 74 | + folder: spring-boot-admin-docs/target/generated-docs/current |
| 75 | + target-folder: / |
| 76 | + clean: false |
0 commit comments