From 776fa0bfdc6a9b468174425f591bc69cf2ec7745 Mon Sep 17 00:00:00 2001 From: Simon Templer Date: Fri, 20 Oct 2023 13:43:20 +0200 Subject: [PATCH] ci: first version of GitHub actions workflows --- .github/workflows/check.yml | 36 +++++++++++++++++++++++++ .github/workflows/publish.yml | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 .github/workflows/check.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..75c9538 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,36 @@ +name: Check + +on: + pull_request: + branches: + - master + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Build and test with Gradle + run: ./gradlew clean check + + # https://github.com/marketplace/actions/junit-report-action + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() # always run even if the previous step fails + with: + report_paths: 'build/test-results/**/*.xml' + require_tests: false # currently no tests present + + annotate_only: true + detailed_summary: true + # fail_on_failure: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..24d54eb --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,51 @@ +name: Publish + +on: + push: + branches: + - master + workflow_dispatch: {} + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - id: install-secret-key + name: Install gpg secret key + run: | + # Install gpg secret key + cat <(echo -e "${{ secrets.SONATYE_PGP_PRIVATE_KEY }}") | gpg --batch --import + # Verify gpg secret key + gpg --list-secret-keys --keyid-format LONG + + - name: Build and publish with Gradle + env: + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signing.password: ${{ secrets.SONATYE_PGP_PASSWORD }} + run: ./gradlew clean check publishToSonatype + # TODO what about publishing releases? + # see https://github.com/gradle-nexus/publish-plugin#publishing-and-closing-in-different-gradle-invocations + + # https://github.com/marketplace/actions/junit-report-action + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() # always run even if the previous step fails + with: + report_paths: 'build/test-results/**/*.xml' + require_tests: false # currently no tests present + + annotate_only: true + detailed_summary: true + # fail_on_failure: true \ No newline at end of file