Build Apk #29
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 Apk | |
on: [workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Sign with debug key | |
run: | | |
sed -i "19i signingConfig signingConfigs.debug" ./app/build.gradle | |
curl -so- https://raw.githubusercontent.com/artem-zinnatullin/RxJavaProGuardRules/master/rxjava-proguard-rules/proguard-rules.txt | tee -a ./app/proguard-rules.pro | |
cat ./app/proguard-rules.pro | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Build debug APK | |
run: ./gradlew assembleDebug --stacktrace | |
- name: Get App Version Name | |
id: version | |
run: echo "::set-output name=app_version::$(grep versionName app/build.gradle | sed -n 's/.*versionName \"\([0-9.]*\)\".*/\1/p')" | |
- name: Rename APK | |
run: mv app/build/outputs/apk/debug/app-debug.apk game-unlocker-v${{ steps.version.outputs.app_version }}.apk | |
- name: Upload APK | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Game Unlocker | |
path: game-unlocker-v${{ steps.version.outputs.app_version }}.apk | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
files: game-unlocker-v${{ steps.version.outputs.app_version }}.apk | |
tag_name: ${{ steps.version.outputs.app_version }} | |
release_name: ${{ steps.version.outputs.app_version }} | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release Assets | |
run: | | |
release_id=${{ steps.create_release.outputs.id }} | |
asset_url=$(curl -X POST \ | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/octet-stream" \ | |
--data-binary "@game-unlocker-v${{ steps.version.outputs.app_version }}.apk" \ | |
"https://uploads.github.com/repos/${{ github.repository }}/releases/$release_id/assets?name=game-unlocker-v${{ steps.version.outputs.app_version }}.apk") | |
echo "Uploaded asset: $asset_url" |