Skip to content

Bump codecov/codecov-action from 4 to 5 #548

Bump codecov/codecov-action from 4 to 5

Bump codecov/codecov-action from 4 to 5 #548

Workflow file for this run

name: Build
on:
pull_request:
workflow_dispatch:
push:
tags:
- 'v*'
branches-ignore:
- 'dependabot/**'
- 'gh-pages'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
if: |
(github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork)
|| (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/')))
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 21
cache: gradle
distribution: temurin
- name: Build
run: ./gradlew build coverage
- name: Publish Test Report
if: success() || failure() # run this step even if previous step failed
continue-on-error: true
uses: dorny/test-reporter@v1
with:
name: test report
path: ./**/build/test-results/test/*.xml
reporter: java-junit
- name: Publish Coverage Report
uses: codecov/codecov-action@v5
if: github.repository == 'coditory/sherlock-distributed-lock' && github.ref == 'refs/heads/main'
with:
token: ${{ secrets.CODECOV_TOKEN }}
override_commit: ${{ github.event.workflow_run.head_sha }}
override_branch: ${{ github.event.workflow_run.head_branch }}
override_build: ${{ github.event.workflow_run.id }}
disable_search: true
files: build/reports/jacoco/coverage/coverage.xml
- name: Import GPG Key
id: gpg
uses: crazy-max/ghaction-import-gpg@v6
if: |
github.repository == 'coditory/sherlock-distributed-lock' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: Coditory Bot
git_committer_email: [email protected]
- name: Publish Snapshot
if: github.repository == 'coditory/sherlock-distributed-lock' && github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
env:
SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: ./gradlew publishToSonatype version
- name: Publish Release
id: publish-release
if: github.repository == 'coditory/sherlock-distributed-lock' && startsWith(github.ref, 'refs/tags/v') && (github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch')
env:
SIGNING_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
SIGNING_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository version -Pversion=${GITHUB_REF_NAME:1}
- name: Generate Release Notes
id: generate-release-notes
if: steps.publish-release.conclusion == 'success'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
declare -r NOTES="$(gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/releases/generate-notes \
-f target_commitish='main' \
-f tag_name=${GITHUB_REF_NAME:1} \
| jq -r '.body')"
declare -r ESCAPED="${NOTES//$'\n'/'%0A'}"
echo "notes=$ESCAPED" >> $GITHUB_OUTPUT
- name: Create github release
if: steps.generate-release-notes.conclusion == 'success'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
body: ${{ steps.notes.outputs.notes }}
token: ${{ secrets.GITHUB_TOKEN }}