|
8 | 8 | - master |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - get_javadocs_status: |
12 | | - name: get-javadocs-status |
13 | | - runs-on: ubuntu-latest |
14 | | - steps: |
15 | | - - uses: actions/checkout@v2 |
16 | | - with: |
17 | | - fetch-depth: 10 # important for use of HEAD^2 |
18 | | - # find the last commit message on the source branch |
19 | | - - name: Get last commit message |
20 | | - shell: bash |
21 | | - run: echo "##[set-output name=commitMsg;]$(git log --format=%B -n 1 HEAD^2)" |
22 | | - id: extract_message |
23 | | - outputs: |
24 | | - # create an output that tells the following jobs whether or not we need to generate javadocs |
25 | | - generate_javadocs: ${{ steps.extract_message.outputs.commitMsg != '--- auto-generation of javadocs ---' }} |
26 | | - |
27 | | - publish-javadocs: |
28 | | - needs: get_javadocs_status |
29 | | - # only run this if we have not generated javadocs in last commit |
30 | | - if: ${{ needs.get_javadocs_status.outputs.generate_javadocs == 'true' }} |
31 | | - runs-on: ubuntu-latest |
32 | | - steps: |
33 | | - - uses: actions/checkout@v2 |
34 | | - - name: Set up JDK 1.8 |
35 | | - uses: actions/setup-java@v1 |
36 | | - with: |
37 | | - java-version: 1.8 |
38 | | - # extract the PR source branch name from the env variable where we can use it later |
39 | | - - name: Extract branch name |
40 | | - shell: bash |
41 | | - run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF#refs/heads/})" |
42 | | - id: extract_branch |
43 | | - # generate the javadocs into the target/site/apidocs folder (default) |
44 | | - - name: Generate javadocs with Maven |
45 | | - run: mvn javadoc:javadoc |
46 | | - # publish the generated javadocs into the /docs folder on a new commit in this branch |
47 | | - - name: Publish javadocs to GitHub Pages |
48 | | - |
49 | | - with: |
50 | | - branch: ${{ steps.extract_branch.outputs.branch }} |
51 | | - folder: target/site/apidocs |
52 | | - target-folder: docs |
53 | | - git-config-name: Continuous Integration |
54 | | - git-config-email: [email protected] |
55 | | - commit-message: --- auto-generation of javadocs --- |
56 | | - token: ${{ secrets.JAVADOCS_CI_TOKEN }} |
57 | | - |
58 | 11 | build: |
59 | | - needs: get_javadocs_status |
60 | | - # only run this if we have already generated javadocs in last commit |
61 | | - if: ${{ needs.get_javadocs_status.outputs.generate_javadocs == 'false' }} |
62 | 12 | runs-on: ubuntu-latest |
63 | 13 | steps: |
64 | 14 | - uses: actions/checkout@v2 |
|
70 | 20 | run: mvn -B compile --file pom.xml |
71 | 21 |
|
72 | 22 | unit-tests: |
73 | | - needs: get_javadocs_status |
74 | 23 | runs-on: ubuntu-latest |
75 | 24 | # only run this if we have already generated javadocs in last commit |
76 | | - if: ${{ needs.get_javadocs_status.outputs.generate_javadocs == 'false' }} |
77 | 25 | steps: |
78 | 26 | - name: Checkout the latest code |
79 | 27 | uses: actions/checkout@v2 |
|
0 commit comments