publish snapshots to gihub packages #10
This file contains hidden or 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: Build | |
| on: | |
| push: | |
| branches: [ develop, next ] | |
| # pull_request: | |
| # branches: [ '**' ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Set up the Java JDK | |
| uses: actions/setup-java@v2 | |
| with: | |
| java-version: '17' | |
| distribution: 'adopt' | |
| server-id: github | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| - name: Build and Publish SNAPSHOT to the GitHub Package Registry | |
| if: ${{ github.event_name == 'push' }} | |
| run: mvn -B verify deploy -DdeployAtEnd=true | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.GH_ACTOR }} | |
| MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
| SIGN_KEY: ${{ secrets.SIGN_KEY }} | |
| SIGN_KEY_PASS: ${{ secrets.SIGN_KEY_PASS }} | |
| # - name: Build and Verify | |
| # if: ${{ github.event_name == 'pull_request' }} | |
| # run: mvn -B verify | |
| - 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: Comment on PR with coverage percentages | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| REPORT=$(<badges/zenwave-sdk-cli/coverage-summary.json) | |
| COVERAGE=$(jq -r '.coverage' <<< "$REPORT")% | |
| BRANCHES=$(jq -r '.branches' <<< "$REPORT")% | |
| NEWLINE=$'\n' | |
| BODY="## JaCoCo Test Coverage Summary Statistics (zenwave-sdk-cli)${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}" | |
| gh pr comment ${{github.event.pull_request.number}} -b "${BODY}" | |
| continue-on-error: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |