Skip to content

Publish Release

Publish Release #6

Workflow file for this run

name: Publish Release
on:
push:
tags:
- '*.*.*'
jobs:
publish-release:
runs-on: macos-latest
if: github.repository == 'amzn/kotlin-inject-anvil'
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- uses: gradle/actions/setup-gradle@v4
- name: Publish release
run: ./gradlew clean publishAndReleaseToMavenCentral --no-build-cache --stacktrace --show-version
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY_PASSWORD }}
- name: Extract release notes
id: release_notes
uses: ffurrer2/extract-release-notes@v2
- name: Check if pre-release
id: prerelease
run: |
version=$(grep VERSION_NAME gradle.properties | cut -d'=' -f2)
if [[ $version == *"-beta"* ]]; then
echo "isPrerelease=true" >> $GITHUB_OUTPUT
else
echo "isPrerelease=false" >> $GITHUB_OUTPUT
fi
- name: Create release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.release_notes.outputs.release_notes }}
prerelease: ${{ steps.prerelease.outputs.isPrerelease }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}