Skip to content

Release

Release #129

Workflow file for this run

name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
jobs:
release:
if: github.repository == 'urbanairship/android-library'
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Get the release notes
id: get_release_notes
env:
VERSION: ${{ steps.get_version.outputs.VERSION }}
run: |
delimiter="$(openssl rand -hex 8)"
{
echo "NOTES<<${delimiter}"
awk "/## Version $VERSION/{flag=1;next}/## Version/{flag=0}flag" CHANGELOG.md
echo ${delimiter}
} >> $GITHUB_OUTPUT
- name: Setup Java Version
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: Verify Version
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
if [[ $(./gradlew -q getVersion) = $VERSION ]]; then exit 0 ; else exit 1; fi
- name: Build
run: ./gradlew assembleRelease packageDocs --stacktrace
- name: Publish to Maven Central
env:
SONATYPE_USERNAME: ${{ secrets.MAVEN_USER }}
SONATYPE_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.MAVEN_STAGING_PROFILE_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
run: >-
./gradlew
urbanairship-core:publishProductionPublicationToSonatypeRepository
urbanairship-layout:publishProductionPublicationToSonatypeRepository
urbanairship-automation:publishProductionPublicationToSonatypeRepository
urbanairship-automation-compose:publishProductionPublicationToSonatypeRepository
urbanairship-message-center:publishProductionPublicationToSonatypeRepository
urbanairship-live-update:publishProductionPublicationToSonatypeRepository
urbanairship-fcm:publishProductionPublicationToSonatypeRepository
urbanairship-adm:publishProductionPublicationToSonatypeRepository
urbanairship-hms:publishProductionPublicationToSonatypeRepository
urbanairship-preference-center:publishProductionPublicationToSonatypeRepository
urbanairship-feature-flag:publishProductionPublicationToSonatypeRepository
--stacktrace
--max-workers 1
closeAndReleaseSonatypeStagingRepository
- name: Github Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
body: ${{ steps.get_release_notes.outputs.NOTES }}
draft: false
prerelease: false
- name: Upload java doc assets
uses: actions/upload-artifact@v3
with:
name: packaged-docs-${{ steps.get_version.outputs.VERSION }}
retention-days: 1
path: |
build/docs/${{ steps.get_version.outputs.VERSION }}.tar.gz
build/docs/${{ steps.get_version.outputs.VERSION }}-kdoc.tar.gz
# The publish-docs workflow will build the docs if we
# somehow fail to upload them in this step.
if-no-files-found: warn
release-docs:
if: github.repository == 'urbanairship/android-library'
needs: release
uses: ./.github/workflows/publish-docs.yml
with:
version: ${{ needs.release.outputs.version }}
secrets:
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}