Skip to content

Fix espresso release #11

Fix espresso release

Fix espresso release #11

name: Espresso (Release)
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type - major, minor or patch'
required: true
default: 'patch'
options:
- 'major'
- 'minor'
- 'patch'
pull_request:
branches:
- main
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
gpg-private-key: ${{ secrets.MVN_CENTRAL_GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.MVN_CENTRAL_GPG_PASSPHRASE }}
- 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=patch)
echo "version=$new_version" >> "$GITHUB_OUTPUT"
#- name: Publish artifact
# run: ./gradlew publishToSonatype closeSonatypeStagingRepository
# env:
# OSSRH_USERNAME: ${{ secrets.MVN_CENTRAL_USERNAME }}
# OSSRH_PASSWORD: ${{ secrets.MVN_CENTRAL_PASSWORD }}
# GPG_PRIVATE_KEY: ${{ secrets.MVN_CENTRAL_GPG_PRIVATE_KEY }}
# GPG_PASSPHRASE: ${{ secrets.MVN_CENTRAL_GPG_PASSPHRASE }}
- name: Push new version to Git
id: push_to_git
run: |
version="${{ steps.upgrade.outputs.version }}"
trimmed_version=$(echo "$version" | xargs)
if [[ -z "$trimmed_version" ]]; then
echo "Version is empty or only whitespace, exiting"
exit 0
fi
tag_name="espresso-$trimmed_version"
git add ./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