Skip to content

Commit

Permalink
Try to --dry-run maven release (#213)
Browse files Browse the repository at this point in the history
* Try to --dry-run maven release

* Update names of jobs
  • Loading branch information
alorma committed Feb 28, 2024
1 parent c71fbc1 commit afebdf2
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 17 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
- name: Build
run: ./gradlew build

lint:
fake-publish:
name: Fake publish - Main
needs: [ build ]
runs-on: macos-latest
steps:
Expand All @@ -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
Expand All @@ -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 }}
Expand Down
66 changes: 64 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 16 additions & 7 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
- name: Build
run: ./gradlew build

lint:
fake-publish:
name: Fake publish - PR
needs: [ build ]
runs-on: macos-latest
steps:
Expand All @@ -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:
Expand All @@ -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 }}
Expand Down

0 comments on commit afebdf2

Please sign in to comment.