update final release 1 #18
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: Build and Release APK | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-release: | |
name: Build And Release APK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 18 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 18 | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Build APK | |
run: ./gradlew assembleRelease | |
- name : Retrieve Version | |
id: android_version | |
run: | | |
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew -q printVersionName)" | |
- name: Upload APK as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-release | |
path: app/build/outputs/apk/release/app-release-unsigned.apk | |
- name: Download APK artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: app-release | |
- name: Get version | |
run: | | |
echo "version_name=${{steps.android_version.outputs.VERSION_NAME}}" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: '${{ env.version_name }}' | |
release_name: 'TextAutomater ${{ env.version_name }}' | |
draft: false | |
prerelease: false | |
body: "Automated release for build #${{ env.version_name }}" | |
- name: Upload APK to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./app-release-unsigned.apk | |
asset_name: textAutomater.apk | |
asset_content_type: application/vnd.android.package-archive |