From 3507762d47e425a1c53304170c1caacafe8aebc5 Mon Sep 17 00:00:00 2001 From: skydoves Date: Sat, 2 Nov 2024 16:44:07 +0900 Subject: [PATCH] Update GitHub workflows --- .github/workflows/android.yml | 57 ++++++++++++++------------ .github/workflows/publish-snapshot.yml | 34 --------------- .github/workflows/publish.yml | 39 ++++++++++-------- 3 files changed, 52 insertions(+), 78 deletions(-) delete mode 100644 .github/workflows/publish-snapshot.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b237bb4..1269f9c 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -9,52 +9,55 @@ on: jobs: lint: name: Spotless check - runs-on: ubuntu-18.04 + runs-on: macos-latest steps: - name: Check out code uses: actions/checkout@v2 - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: 11 + distribution: 'zulu' + java-version: 17 - name: spotless run: ./gradlew spotlessCheck api_check: name: API check - runs-on: ubuntu-18.04 + runs-on: macos-latest steps: - name: Check out code uses: actions/checkout@v2 - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: 11 + distribution: 'zulu' + java-version: 17 - name: API check run: ./gradlew apiCheck build: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - - uses: actions/checkout@v2 - - - name: set up JDK - uses: actions/setup-java@v1 - with: - java-version: 11 - - - name: Cache Gradle and wrapper - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Make Gradle executable - run: chmod +x ./gradlew - - - name: Build with Gradle - run: ./gradlew build + - uses: actions/checkout@v2 + + - name: set up JDK + uses: actions/setup-java@v1 + with: + distribution: 'zulu' + java-version: 17 + + - name: Cache Gradle and wrapper + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Make Gradle executable + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew build \ No newline at end of file diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml deleted file mode 100644 index 75d6b46..0000000 --- a/.github/workflows/publish-snapshot.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Publish Snapshot builds - -on: - push: - branches: - - main - workflow_dispatch: - -jobs: - publish: - name: Snapshot build and publish - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - distribution: adopt - java-version: 11 - - name: Release build - run: ./gradlew assemble --scan - - name: Source jar and dokka - run: ./gradlew androidSourcesJar javadocJar --scan - - name: Publish to MavenCentral - run: ./gradlew publishReleasePublicationToSonatypeRepository --scan - env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} - SNAPSHOT: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 96f97a1..ea6928e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,30 +2,35 @@ name: Publish on: release: - types: [released] + types: [ released ] + workflow_dispatch: jobs: publish: - name: Release build and publish - runs-on: ubuntu-latest + name: Snapshot build and publish + runs-on: macos-latest steps: - name: Check out code - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/checkout@v3.1.0 + + - name: Set up JDK 17 + uses: actions/setup-java@v3.5.1 with: - distribution: adopt - java-version: 11 + distribution: 'zulu' + java-version: 17 + + - name: Grant Permission to Execute Gradle + run: chmod +x gradlew + - name: Release build run: ./gradlew assemble --scan - - name: Source jar and dokka - run: ./gradlew androidSourcesJar javadocJar --scan + - name: Publish to MavenCentral - run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository --scan + run: | + ./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} - SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - SIGNING_KEY: ${{ secrets.SIGNING_KEY }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} \ No newline at end of file