Merge pull request #33 from kuylar/fix/ci #2
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 | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- 'master' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
name: Build Signed APK | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Set version | |
run: echo VERSION_NAME=`date +%Y.%m.%d` >> $GITHUB_ENV | |
# Here we need to decode keystore.jks from base64 string and place it | |
# in the folder specified in the release signing configuration | |
- name: Decode Keystore | |
id: decode_keystore | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: 'android_keystore.jks' | |
fileDir: '/home/runner/work/LightTube-Android/LightTube-Android/app/keystore/' | |
encodedString: ${{ secrets.KEYSTORE }} | |
# Build and sign APK ("-x test" argument is used to skip tests) | |
- name: Build APK | |
run: ./gradlew :app:assembleRelease -x test | |
env: | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
# Show information about the APK's signing certificates | |
- name: Verify Signature | |
run: $ANDROID_SDK_ROOT/build-tools/33.0.1/apksigner verify --print-certs app/build/outputs/apk/release/app-release.apk | |
# Save the APK after the Build job is complete to publish it as a Github release in the next job | |
- name: Upload APK | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: LightTube | |
path: app/build/outputs/apk/release/app-release.apk | |
release: | |
name: Release APK | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download APK from build | |
uses: actions/download-artifact@v1 | |
with: | |
name: LightTube | |
- name: Set version | |
run: echo VERSION_NAME=`date +%Y.%m.%d` >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ env.VERSION_NAME }} | |
name: Release v${{ env.VERSION_NAME }} | |
draft: false | |
prerelease: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: LightTube/app-release.apk |