From 130fc218aacd9f0945eef116d92283d9c84b6397 Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Sun, 24 Mar 2024 10:31:08 +0100 Subject: [PATCH] use template example --- .github/workflows/actions.yml | 32 ++++++++++++++++++++++---------- README.md | 4 ++-- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 45d4441..2ebe086 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -22,22 +22,34 @@ jobs: - name: Build with Maven run: mvn -B clean install - - name: Generate JaCoCo Badge + - name: Generate Jacoco Badge + id: jacoco uses: cicirello/jacoco-badge-generator@v2 with: generate-branches-badge: true - - name: setup git config + - name: Log coverage percentage run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" + echo "coverage = ${{ steps.jacoco.outputs.coverage }}" + echo "branches = ${{ steps.jacoco.outputs.branches }}" - - name: commit + - name: Commit and push + if: ${{ github.event_name != 'pull_request' }} run: | - # Stage the file, commit and push - git add . - git commit -m "coverage badge" - git push origin main - + cd .github/badges + if [[ `git status --porcelain *.svg` ]]; then + git config --global user.name 'github-actions' + git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' + git add *.svg + git commit -m "Autogenerated JaCoCo coverage badge" *.svg + git push + fi + + - name: Upload Jacoco coverage report + uses: actions/upload-artifact@v4 + with: + name: jacoco-report + path: target/site/jacoco/ + - name: Codecov uses: codecov/codecov-action@v1.3.1 diff --git a/README.md b/README.md index 5f4eab6..c8f3be1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## openconext-crypt-java -![Coverage](.github/badges/jacoco.svg) -[![coverage](https://raw.githubusercontent.com/OpenConext/openconext-crypt-java/badges/jacoco.svg)](https://github.com/OpenConext/openconext-crypt-java/actions/workflows/build.yml) [![branches coverage](https://raw.githubusercontent.com/OpenConext/openconext-crypt-java/badges/branches.svg)](https://github.com/OpenConext/openconext-crypt-java/actions/workflows/actions.yml) +![coverage](.github/badges/jacoco.svg) +![branches coverage](.github/badges/branches.svg) Create private / public keypair ```