From 31aa1ce8785e5d2d599e632bb46e5caf6c314cbe Mon Sep 17 00:00:00 2001 From: ehsan shariati Date: Sun, 14 Jan 2024 20:09:42 -0500 Subject: [PATCH] Update build-android.yml --- .github/workflows/build-android.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 10f2601..bc3c64c 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -44,15 +44,34 @@ jobs: with: java-version: '11' # Specify the Java version distribution: 'adopt' + + - name: Get Release Info + id: get-release-info + uses: actions/github-script@v5 + with: + script: | + let releaseVersion = '0.0.0'; + try { + const release = await github.rest.repos.getLatestRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + }); + releaseVersion = release.data.tag_name; + } catch (error) { + console.log('Error fetching latest release: ', error.message); + } + return releaseVersion; + - name: Print release + run: echo "Latest Release is ${{ steps.get-release-info.outputs.result }}" - name: Install package with Maven run: | FILE="-Dfile=./build/mobile.aar" - mvn install:install-file $FILE -DgroupId=land.fx -DartifactId=fulamobile -Dversion=${{ github.event.release.tag_name }} -Dpackaging=aar -DgeneratePom=true + mvn install:install-file $FILE -DgroupId=land.fx -DartifactId=fulamobile -Dversion=${{ steps.get-release-info.outputs.result }} -Dpackaging=aar -DgeneratePom=true - name: Deploy to GitHub Packages run: | - mvn deploy -Drelease_version=${{ github.event.release.tag_name }} + mvn deploy -Drelease_version=${{ steps.get-release-info.outputs.result }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}