Skip to content

Commit

Permalink
build: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Citymonstret committed Jan 26, 2024
1 parent 9275955 commit ebe46b6
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 7 deletions.
31 changes: 24 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
tags-ignore: [ "**" ]
pull_request:
release:
types: [ released ]
types: [ published ]
jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
Expand All @@ -19,13 +19,19 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
- uses: gradle/gradle-build-action@v2
with:
# allow main and *-dev branches to write caches (default is only main/main)
cache-read-only: ${{ github.ref != 'refs/heads/main' && !(endsWith(github.ref, '-dev') && startsWith(github.ref, 'refs/heads/')) }}
- name: Build
run: ./gradlew build
- name : Test Summary
uses : EnricoMi/[email protected]
with :
junit_files : "**/build/test-results/test/TEST-*.xml"
if : always()
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results
path: |
**/build/test-results/test/TEST-*.xml
- name: Determine Status
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
Expand All @@ -34,7 +40,7 @@ jobs:
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Publish Snapshot
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}"
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}"
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
Expand All @@ -47,3 +53,14 @@ jobs:
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.SIGNING_KEY }}"
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.SIGNING_PASSWORD }}"
event_file:
name: "Event File"
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
33 changes: 33 additions & 0 deletions .github/workflows/test_results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test Results

on:
workflow_run:
workflows: [ "Build cloud-spring" ]
types:
- completed
permissions: { }

jobs:
test-results:
name: Test Results
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion != 'skipped'
permissions:
checks: write
# needed unless run with comment_mode: off
pull-requests: write
# required by download step to access artifacts API
actions: read
steps:
- name: Download and Extract Artifacts
uses: dawidd6/action-download-artifact@v3
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"

0 comments on commit ebe46b6

Please sign in to comment.