Update release.yml #35
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 an release | |
on: | |
push: | |
branches: main | |
tags: | |
- v* | |
jobs: | |
build: | |
name: Build Signed APK | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
# 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/[email protected] | |
with: | |
fileName: 'android_keystore.jks' | |
fileDir: '/home/runner/work/MediaBrowser-for-Spotify/MediaBrowser-for-Spotify/app/keystore/' | |
encodedString: ${{ secrets.SIGNING_KEY_STORE_BASE64 }} | |
# 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/[email protected] | |
with: | |
name: release-artifacts | |
path: app/build/outputs/apk/release/ | |
- name: Create Github Pre Release Release | |
if: ${{ endsWith(github.ref_name, 'beta') }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
prerelease: true | |
files: app/build/outputs/apk/release/app-release.apk | |
- name: Create Github Release Release | |
if: ${{ !endsWith(github.ref_name, 'beta') }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
prerelease: false | |
files: app/build/outputs/apk/release/app-release.apk |