diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34ed5e19..bb000785 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,8 @@ jobs: - name: Build run: ./gradlew build - lint: + fake-publish: + name: Fake publish - Main needs: [ build ] runs-on: macos-latest steps: @@ -48,12 +49,20 @@ jobs: ~/.gradle/wrapper key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} - - name: Lint - run: ./gradlew lintRelease - # Run lint on app (runs on all modules) in order to generate a single report instead of a report per module + # Runs upload, and then closes & releases the repository + - name: Publish to MavenLocal + run: ./gradlew publishReleasePublicationToMavenLocal --max-workers 1 + env: + OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_KEY_NAME: ${{ vars.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + SIGNING_SECRET_KEY_RING_FILE: ${{ vars.SIGNING_SECRET_KEY_RING_FILE }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} - fake-publish: - needs: [ build, lint ] + publish-dry: + name: Dry run publish - Main + needs: [ build ] runs-on: macos-latest steps: - name: Check out code @@ -72,8 +81,8 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} # Runs upload, and then closes & releases the repository - - name: Publish to MavenLocal - run: ./gradlew publishReleasePublicationToMavenLocal --max-workers 1 + - name: Publish to MavenCentral + run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository --dry-run env: OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e3d76bd3..344a360a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,17 +6,79 @@ on: types: [ released ] jobs: - publish: + build: + name: Build - Release runs-on: macos-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: adopt + java-version: 17 + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} + + # Builds the release artifacts of the library + - name: Build + run: ./gradlew build + fake-publish: + name: Fake publish - Release + needs: [ build ] + runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - name: Check out code + uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: adopt + java-version: 17 + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} + + # Runs upload, and then closes & releases the repository + - name: Publish to MavenLocal + run: ./gradlew publishReleasePublicationToMavenLocal --max-workers 1 + env: + OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_KEY_NAME: ${{ vars.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + SIGNING_SECRET_KEY_RING_FILE: ${{ vars.SIGNING_SECRET_KEY_RING_FILE }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + publish: + name: Publish - Release + needs: [ build ] + runs-on: macos-latest + steps: + - name: Check out code + uses: actions/checkout@v4 - name: Set up JDK uses: actions/setup-java@v4 with: distribution: adopt java-version: 17 + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} # Runs upload, and then closes & releases the repository - name: Publish to MavenCentral diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9bd90f8c..3fe3d69a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -29,7 +29,8 @@ jobs: - name: Build run: ./gradlew build - lint: + fake-publish: + name: Fake publish - PR needs: [ build ] runs-on: macos-latest steps: @@ -48,11 +49,19 @@ jobs: ~/.gradle/wrapper key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} - - name: Lint - run: ./gradlew lintRelease - # Run lint on app (runs on all modules) in order to generate a single report instead of a report per module + # Runs upload, and then closes & releases the repository + - name: Publish to MavenLocal + run: ./gradlew publishReleasePublicationToMavenLocal --max-workers 1 + env: + OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_KEY_NAME: ${{ vars.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + SIGNING_SECRET_KEY_RING_FILE: ${{ vars.SIGNING_SECRET_KEY_RING_FILE }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} - fake-publish: + publish-dry: + name: Dry run publish - PR needs: [ build ] runs-on: macos-latest steps: @@ -72,8 +81,8 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} # Runs upload, and then closes & releases the repository - - name: Publish to MavenLocal - run: ./gradlew publishReleasePublicationToMavenLocal --max-workers 1 + - name: Publish to MavenCentral + run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository --dry-run env: OSSRH_USERNAME: ${{ vars.OSSRH_USERNAME }} OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}