diff --git a/.github/workflows/pull_request.yml b/.github/workflows/ci.yml similarity index 52% rename from .github/workflows/pull_request.yml rename to .github/workflows/ci.yml index 885bddf..20c66b9 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Pull requests +name: CI on: pull_request: @@ -7,38 +7,35 @@ on: - main jobs: - - build_job: - name: Build Pull Request + Build: + name: Build & test source code runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 + - name: Checkout code + uses: actions/checkout@v3 - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: + distribution: adopt java-version: 11 - name: Install dependencies run: bash ./install_deps.sh - name: Compile Project - run: | - ./gradlew buildHeaders build + run: ./gradlew buildHeaders build - - name: create unit coverage - run: | - ./gradlew createCodeCoverageReport + - name: Create code coverage report + run: ./gradlew createCodeCoverageReport - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + - name: Upload code coverage to Codecov + uses: codecov/codecov-action@v3 - name: Upload Coverage to GH-Actions uses: actions/upload-artifact@v2.2.0 - if: ${{ always() }} + if: ${{ always() }} with: name: Tests Coverage Report path: | diff --git a/.github/workflows/release.yml b/.github/workflows/publish.yml similarity index 61% rename from .github/workflows/release.yml rename to .github/workflows/publish.yml index c394331..d5800e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/publish.yml @@ -1,23 +1,16 @@ -name: Build Java-LibKiwix +name: Publish to Maven Central on: - push: - branches-ignore: - - '*' - - '*/**' - tags: - - '*' - - '*/**' + release: + types: [published] jobs: publish: - runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 1 + - name: Checkout code + uses: actions/checkout@v3 - name: Set up JDK 11 uses: actions/setup-java@v2 @@ -28,20 +21,12 @@ jobs: - name: Install dependencies run: bash ./install_deps.sh - - name: Compile Project - run: | - ./gradlew buildHeaders build + - name: Compile and prepare package + run: ./gradlew buildHeaders build assemble androidSourcesJar - - name: Release build - run: | - ./gradlew assemble - - - name: Generate Source jar - run: | - ./gradlew androidSourcesJar - - - name: Publish to MavenCentral + - name: Publish run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository + if: github.event_name == 'release' env: OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}