Release #15
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
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
prerelease: | |
description: "Prerelease" | |
required: true | |
type: boolean | |
draft: | |
description: "Draft" | |
required: true | |
type: boolean | |
version-increment-type: | |
description: 'Which part of the version to increment:' | |
required: true | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
default: 'patch' | |
permissions: | |
contents: write | |
jobs: | |
release: | |
name: Version Bump and Release | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the repo with credentials that can bypass branch protection, and fetch git history instead of just latest commit | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
fetch-depth: 0 | |
- uses: DevCycleHQ/release-action/[email protected] | |
id: prepare-release | |
with: | |
github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
prerelease: ${{ github.event.inputs.prerelease }} | |
draft: ${{ github.event.inputs.draft }} | |
version-increment-type: ${{ github.event.inputs.version-increment-type }} | |
- name: Update Version in code | |
run: | | |
sed -i "s/^version = \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/version = \"${{steps.prepare-release.outputs.next-release-tag}}\"/g" android-client-sdk/build.gradle | |
sed -i "s/^implementation(\"com.devcycle:android-client-sdk:[0-9]\+\.[0-9]\+\.[0-9]\+\")/implementation(\"com.devcycle:android-client-sdk:${{steps.prepare-release.outputs.next-release-tag}}\")/g" README.md | |
- name: Commit version change | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "DevCycle Automation" | |
git add ./android-client-sdk/build.gradle | |
git add ./README.md | |
git commit -m "Release ${{steps.prepare-release.outputs.next-release-tag}}" | |
- name: Push version change | |
run: | | |
git push origin HEAD:main | |
if: inputs.draft != true | |
- name: Set up Java 18 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 18 | |
cache: 'gradle' | |
- name: Build and Publish To Sonatype Staging | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
ORG_GRADLE_PROJECT_sonatypeStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | |
run: | | |
./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache | |
- name: Release Sonatype Staging Repository | |
if: inputs.prerelease != true && inputs.draft != true | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
ORG_GRADLE_PROJECT_sonatypeStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | |
run: ./gradlew closeAndReleaseRepository | |
- uses: DevCycleHQ/release-action/[email protected] | |
id: create-release | |
with: | |
github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
tag: ${{ steps.prepare-release.outputs.next-release-tag }} | |
target: main | |
prerelease: ${{ github.event.inputs.prerelease }} | |
draft: ${{ github.event.inputs.draft }} | |
changelog: ${{ steps.prepare-release.outputs.changelog }} | |
- name: Display link to release | |
run: | | |
echo "::notice title=Release ID::${{ steps.create-release.outputs.release-id }}" | |
echo "::notice title=Release URL::${{ steps.create-release.outputs.release-url }}" |