|
16 | 16 |
|
17 | 17 | jobs: |
18 | 18 | build: |
19 | | - if: github.actor != 'github-actions[bot]' |
20 | 19 | runs-on: ubuntu-latest |
21 | | - permissions: |
22 | | - contents: write |
23 | 20 | steps: |
24 | 21 | - name: Checkout repository |
25 | 22 | uses: actions/checkout@v6 |
26 | | - with: |
27 | | - token: ${{ secrets.GIT_BOT_TOKEN || github.token }} |
28 | 23 |
|
29 | 24 | - name: Set up Java |
30 | 25 | uses: actions/setup-java@v4 |
@@ -34,26 +29,21 @@ jobs: |
34 | 29 | cache: maven |
35 | 30 |
|
36 | 31 | - name: Build jar with Maven |
| 32 | + id: build_jar |
| 33 | + continue-on-error: true |
37 | 34 | working-directory: assets/spring-sleuth |
38 | | - run: mvn package |
39 | | - |
40 | | - - name: Commit rebuilt jar to PR branch |
41 | | - if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && env.GIT_BOT_TOKEN != '' && env.GIT_BOT_NAME != '' && env.GIT_BOT_EMAIL != '' |
42 | | - env: |
43 | | - GIT_BOT_TOKEN: ${{ secrets.GIT_BOT_TOKEN }} |
44 | | - GIT_BOT_NAME: ${{ secrets.GIT_BOT_NAME }} |
45 | | - GIT_BOT_EMAIL: ${{ secrets.GIT_BOT_EMAIL }} |
46 | 35 | run: | |
47 | | - git config user.name "${GIT_BOT_NAME}" |
48 | | - git config user.email "${GIT_BOT_EMAIL}" |
49 | | - git remote set-url origin "https://x-access-token:${GIT_BOT_TOKEN}@github.com/${{ github.repository }}.git" |
50 | | -
|
51 | | - git add assets/spring-sleuth/target/spring-sleuth-0.0.1.jar |
52 | | - if git diff --cached --quiet; then |
53 | | - echo "No jar changes to commit" |
54 | | - exit 0 |
55 | | - fi |
| 36 | + mvn package |
56 | 37 |
|
57 | | - git commit -m "Build spring-sleuth-0.0.1.jar with 'mvn package'" |
58 | | - git push origin "HEAD:${{ github.head_ref }}" |
| 38 | + - name: Report successful package build |
| 39 | + if: steps.build_jar.outcome == 'success' |
| 40 | + run: | |
| 41 | + echo "mvn package succeeded." |
| 42 | + echo "Please rebuild and push assets/spring-sleuth/target/spring-sleuth-0.0.1.jar manually in a new PR." |
59 | 43 |
|
| 44 | + - name: Report failed package build |
| 45 | + if: steps.build_jar.outcome == 'failure' |
| 46 | + run: | |
| 47 | + echo "mvn package failed." |
| 48 | + echo "The automatic update requires further code changes before the jar can be rebuilt. Check previous build jar step for details." |
| 49 | + exit 1 |