Skip to content

Espresso (Release)

Espresso (Release) #16

name: Espresso (Release)
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type - major, minor or patch'
required: true
default: 'patch'
options:
- 'major'
- 'minor'
- 'patch'
defaults:
run:
working-directory: visual-espresso
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
server-id: ossrh
- name: Set up Git
if: ${{ steps.prep.outputs.tag_name == '' }}
run: |
git config --global user.name "sauce-visual-bot"
git config --global user.email "[email protected]"
- name: Set up Android SDK
uses: android-actions/setup-android@v3
- name: Bump version
id: upgrade
run: |
new_version=$(./gradlew -q bumpVersion -PreleaseType=${{ github.event.inputs.releaseType }})
echo "version=$new_version" >> "$GITHUB_OUTPUT"
- name: Build, publish and release artifact
run: ./gradlew build publishAndReleaseToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MVN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MVN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MVN_CENTRAL_GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MVN_CENTRAL_GPG_PASSPHRASE }}
- name: Push new version to Git
id: push_to_git
run: |
tag_name="espresso-${{ steps.upgrade.outputs.version }}"
git add ./visual/build.gradle
git commit -m "[release] $tag_name"
git tag $tag_name
git push
git push origin $tag_name
echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT"
- name: Github Release
uses: softprops/action-gh-release@v2
with:
fail_on_unmatched_files: true
tag_name: ${{ steps.push_to_git.outputs.tag_name }}
files: visual-espresso/visual/build/outputs/aar/visual-release.aar
generate_release_notes: true