Skip to content

Release

Release #58

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
releaseModule:
required: true
type: choice
default: '-'
description: Module
options:
- '-'
- evaluation-core
- evaluation-interop
- all
version:
required: true
type: string
description: Release Version (no 'v' prefix)
dryRun:
required: true
type: boolean
description: Dry Run
default: true
jobs:
authorize:
name: Authorize
runs-on: ubuntu-latest
steps:
- name: ${{ github.actor }} permission check to do a release
uses: octokit/[email protected]
with:
route: GET /repos/:repository/collaborators/${{ github.actor }}
repository: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Release
runs-on: ubuntu-latest
needs: [authorize]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: zulu
cache: gradle
- name: Validate Release Version
if: ${{ startsWith(github.event.inputs.version, 'v') }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('Version ${{ github.event.inputs.version }} must not start with \'v\'. Use a non-prefixed semantic version, e.g. 1.2.3')
- name: Lint
run: ./gradlew ktlintCheck
- name: Clean
run: ./gradlew clean
- name: Build
run: ./gradlew assemble
- name: Test
run: ./gradlew jvmTest --info
- name: Set Version (evaluation-core)
if: ${{ github.event.inputs.dryRun == 'false' && (github.event.inputs.releaseModule == 'evaluation-core' || github.event.inputs.releaseModule == 'all') }}
uses: jacobtomlinson/gha-find-replace@v2
with:
find: 'version = ".*"'
replace: 'version = "${{ github.event.inputs.version }}"'
include: 'evaluation-core/build.gradle.kts'
regex: true
- name: Release evaluation-core ${{ github.event.inputs.version }}
if: ${{ github.event.inputs.dryRun == 'false' && (github.event.inputs.releaseModule == 'evaluation-core' || github.event.inputs.releaseModule == 'all') }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
run: |
./gradlew evaluation-core:publishJvmPublicationToSonatypeRepository
- name: Set Version (evaluation-interop)
if: ${{ github.event.inputs.dryRun == 'false' && (github.event.inputs.releaseModule == 'evaluation-interop' || github.event.inputs.releaseModule == 'all') }}
uses: jacobtomlinson/gha-find-replace@v2
with:
find: 'version = ".*"'
replace: 'version = "${{ github.event.inputs.version }}"'
include: 'evaluation-interop/build.gradle.kts'
regex: true
- name: Commit Release
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: amplitude-sdk-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: amplitude-sdk-bot
GIT_COMMITTER_EMAIL: [email protected]
run: |
git commit -am "release: ${{ github.event.inputs.releaseModule }} ${{ github.event.inputs.version }}"
git tag ${{ github.event.inputs.version }}
git push
git push --tags