v1.0.1 #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to Maven Central | |
on: | |
release: | |
types: [created] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Java for publishing to Maven Central Repository | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Publish to the Maven Central Repository | |
run: mvn --batch-mode deploy -DdeployAtEnd=true -Dmaven.javadoc.skip=false | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
SIGN_KEY: ${{ secrets.SIGN_KEY }} | |
SIGN_KEY_PASS: ${{ secrets.SIGN_KEY_PASS }} | |
- name: Checkout badges branch to a badges directory nested inside first checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: badges | |
path: badges | |
- name: Generate JaCoCo Badge | |
id: jacoco | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
badges-directory: badges | |
generate-branches-badge: true | |
generate-summary: true | |
- name: Log coverage percentage | |
run: | | |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}" | |
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}" | |
- name: Packs Jacoco Reports | |
run: | | |
rm -rf badges/jacoco | |
mkdir -p badges/jacoco | |
echo "GROUP,PACKAGE,CLASS,INSTRUCTION_MISSED,INSTRUCTION_COVERED,BRANCH_MISSED,BRANCH_COVERED,LINE_MISSED,LINE_COVERED,COMPLEXITY_MISSED,COMPLEXITY_COVERED,METHOD_MISSED,METHOD_COVERED" > badges/jacoco-report.csv | |
find -name 'jacoco.csv' -exec sed '1d' {} \; >> badges/jacoco-report.csv | |
tar -c `find -name jacoco.csv` `find -name jacoco.exec` `find -name jacoco.xml` | tar -C badges/jacoco -x | |
- name: Commit and push the coverage badges and summary file | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
echo $(ls -l) | |
cd badges | |
if [[ `git status --porcelain` ]]; then | |
git config --global user.name 'github-agit pctions' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add *.svg *.json jacoco-report.csv jacoco/* | |
git commit -m "coverage = ${{ steps.jacoco.outputs.coverage }} branches = ${{ steps.jacoco.outputs.branches }}" *.svg *.json jacoco-report.csv jacoco/* | |
git push | |
git tag coverage_badges_${{github.event.release.tag_name}} | |
git push --tags | |
fi |