Allow reusing common test resources code generation (#373) #65
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file was generated using Kotlin DSL (.github/workflows/release.main.kts). | |
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file. | |
# Generated with https://github.com/typesafegithub/github-workflows-kt | |
name: 'Publish release to Maven Central or snapshot repo' | |
on: | |
push: | |
branches: | |
- 'main' | |
workflow_dispatch: {} | |
jobs: | |
check_yaml_consistency: | |
name: 'Check YAML consistency' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- id: 'step-0' | |
name: 'Check out' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
name: 'Execute script' | |
run: 'rm ''.github/workflows/release.yaml'' && ''.github/workflows/release.main.kts''' | |
- id: 'step-2' | |
name: 'Consistency check' | |
run: 'git diff --exit-code ''.github/workflows/release.yaml''' | |
create-staging-repo: | |
name: 'Create staging repository' | |
runs-on: 'ubuntu-latest' | |
needs: | |
- 'check_yaml_consistency' | |
outputs: | |
repositoryId: '${{ steps.step-0.outputs.repository_id }}' | |
steps: | |
- id: 'step-0' | |
uses: 'nexus-actions/create-nexus-staging-repo@v1' | |
with: | |
username: '${{ secrets.SONATYPE_USERNAME }}' | |
password: '${{ secrets.SONATYPE_PASSWORD }}' | |
staging_profile_id: '${{ secrets.SONATYPE_STAGING_PROFILE_ID }}' | |
publish-artifacts: | |
runs-on: 'macos-latest' | |
needs: | |
- 'create-staging-repo' | |
- 'check_yaml_consistency' | |
steps: | |
- id: 'step-0' | |
uses: 'actions/checkout@v4' | |
- id: 'step-1' | |
name: 'Set up Gradle Daemon JDK' | |
uses: 'actions/setup-java@v4' | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- id: 'step-2' | |
name: 'Cache Kotlin Konan' | |
uses: 'actions/cache@v4' | |
with: | |
path: '~/.konan/**/*' | |
key: 'kotlin-konan-${{ runner.os }}' | |
- id: 'step-3' | |
name: 'Set up Gradle' | |
uses: 'gradle/actions/setup-gradle@v4' | |
with: | |
gradle-version: 'wrapper' | |
- id: 'step-4' | |
name: 'Publish' | |
env: | |
ORG_GRADLE_PROJECT_snake-kmp.ossrhUsername: '${{ secrets.SONATYPE_USERNAME }}' | |
ORG_GRADLE_PROJECT_snake-kmp.ossrhPassword: '${{ secrets.SONATYPE_PASSWORD }}' | |
ORG_GRADLE_PROJECT_snake-kmp.ossrhStagingRepositoryId: '${{ needs.create-staging-repo.outputs.repositoryId }}' | |
ORG_GRADLE_PROJECT_snake-kmp.signing.keyId: '${{ secrets.SIGNING_KEY_ID }}' | |
ORG_GRADLE_PROJECT_snake-kmp.signing.key: '${{ secrets.SIGNING_KEY }}' | |
ORG_GRADLE_PROJECT_snake-kmp.signing.password: '${{ secrets.SIGNING_PASSWORD }}' | |
run: './gradlew publishAllPublicationsToSonatypeReleaseRepository --stacktrace' | |
close-staging-repo: | |
runs-on: 'ubuntu-latest' | |
needs: | |
- 'create-staging-repo' | |
- 'publish-artifacts' | |
- 'check_yaml_consistency' | |
if: '${{ needs.publish-artifacts.result == ''success'' }}' | |
steps: | |
- id: 'step-0' | |
uses: 'nexus-actions/release-nexus-staging-repo@v1' | |
with: | |
username: '${{ secrets.SONATYPE_USERNAME }}' | |
password: '${{ secrets.SONATYPE_PASSWORD }}' | |
staging_repository_id: '${{ needs.create-staging-repo.outputs.repositoryId }}' | |
drop-staging-repo: | |
runs-on: 'ubuntu-latest' | |
needs: | |
- 'create-staging-repo' | |
- 'publish-artifacts' | |
- 'check_yaml_consistency' | |
if: '${{ !cancelled() && needs.publish-artifacts.result != ''success'' }}' | |
steps: | |
- id: 'step-0' | |
uses: 'nexus-actions/drop-nexus-staging-repo@v1' | |
with: | |
username: '${{ secrets.SONATYPE_USERNAME }}' | |
password: '${{ secrets.SONATYPE_PASSWORD }}' | |
staging_repository_id: '${{ needs.create-staging-repo.outputs.repositoryId }}' |