Skip to content

Commit ebe46b6

Browse files
committed
build: update workflows
1 parent 9275955 commit ebe46b6

File tree

2 files changed

+57
-7
lines changed

2 files changed

+57
-7
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
tags-ignore: [ "**" ]
66
pull_request:
77
release:
8-
types: [ released ]
8+
types: [ published ]
99
jobs:
1010
build:
1111
# Only run on PRs if the source branch is on someone else's repo
@@ -19,13 +19,19 @@ jobs:
1919
with:
2020
distribution: 'temurin'
2121
java-version: 17
22+
- uses: gradle/gradle-build-action@v2
23+
with:
24+
# allow main and *-dev branches to write caches (default is only main/main)
25+
cache-read-only: ${{ github.ref != 'refs/heads/main' && !(endsWith(github.ref, '-dev') && startsWith(github.ref, 'refs/heads/')) }}
2226
- name: Build
2327
run: ./gradlew build
24-
- name : Test Summary
25-
uses : EnricoMi/[email protected]
26-
with :
27-
junit_files : "**/build/test-results/test/TEST-*.xml"
28-
if : always()
28+
- name: Upload Test Results
29+
if: always()
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: Test Results
33+
path: |
34+
**/build/test-results/test/TEST-*.xml
2935
- name: Determine Status
3036
run: |
3137
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
@@ -34,7 +40,7 @@ jobs:
3440
echo "STATUS=release" >> $GITHUB_ENV
3541
fi
3642
- name: Publish Snapshot
37-
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}"
43+
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}"
3844
run: ./gradlew publish
3945
env:
4046
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
@@ -47,3 +53,14 @@ jobs:
4753
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
4854
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.SIGNING_KEY }}"
4955
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.SIGNING_PASSWORD }}"
56+
event_file:
57+
name: "Event File"
58+
# Only run on PRs if the source branch is on someone else's repo
59+
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Upload
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: Event File
66+
path: ${{ github.event_path }}

.github/workflows/test_results.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Test Results
2+
3+
on:
4+
workflow_run:
5+
workflows: [ "Build cloud-spring" ]
6+
types:
7+
- completed
8+
permissions: { }
9+
10+
jobs:
11+
test-results:
12+
name: Test Results
13+
runs-on: ubuntu-latest
14+
if: github.event.workflow_run.conclusion != 'skipped'
15+
permissions:
16+
checks: write
17+
# needed unless run with comment_mode: off
18+
pull-requests: write
19+
# required by download step to access artifacts API
20+
actions: read
21+
steps:
22+
- name: Download and Extract Artifacts
23+
uses: dawidd6/action-download-artifact@v3
24+
with:
25+
run_id: ${{ github.event.workflow_run.id }}
26+
path: artifacts
27+
- name: Publish Test Results
28+
uses: EnricoMi/publish-unit-test-result-action@v2
29+
with:
30+
commit: ${{ github.event.workflow_run.head_sha }}
31+
event_file: artifacts/Event File/event.json
32+
event_name: ${{ github.event.workflow_run.event }}
33+
files: "artifacts/**/*.xml"

0 commit comments

Comments
 (0)