Release #6
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: | |
jobs: | |
prepare: | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.which_version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Test | |
run: ./gradlew test | |
- name: Which Version | |
id: which_version | |
run: echo "version=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT | |
- name: Check if release exists | |
uses: cardinalby/[email protected] | |
id: release_exists | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
releaseName: v${{ steps.which_version.outputs.version }} | |
doNotFailIfNotFound: "true" | |
- name: Cancelling - release already exists | |
uses: andymckay/[email protected] | |
if: steps.release_exists.outputs.id != '' | |
- name: Build + Sign | |
run: ./gradlew signMavenPublication | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_SIGNING_PASSWORD }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: | | |
**/build/libs/* | |
**/build/outputs/aar/* | |
if-no-files-found: error | |
release: | |
needs: [ prepare ] | |
if: github.repository_owner == 'viamrobotics' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifact | |
merge-multiple: true | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: v${{ needs.prepare.outputs.version }} | |
draft: true | |
prerelease: ${{ contains(needs.prepare.outputs.version, 'SNAPSHOT') }} | |
files: artifact/** | |
fail_on_unmatched_files: true |