try out gradle/actions/setup-gradle@v3 #31
Workflow file for this run
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, Release | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build_release_github: | |
environment: production | |
env: | |
KEYSTORE_DIR: keystore | |
FLAVOR: github | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Generate keystore.properties | |
run: | | |
mkdir -p ${{ env.KEYSTORE_DIR }} && cat << EOF > "${{ env.KEYSTORE_DIR }}/${{ env.FLAVOR }}.properties" | |
storeFile:${{ vars.GH_KEYSTORE_STORE_FILE_PATH }} | |
storePassword:${{ secrets.GH_KEYSTORE_STORE_PASSWORD }} | |
keyAlias:${{ secrets.GH_KEYSTORE_KEY_ALIAS }} | |
keyPassword:${{ secrets.GH_KEYSTORE_KEY_PASSWORD }} | |
EOF | |
- name: Generate keystore.jks | |
run: echo "${{ secrets.GH_KEYSTORE_JKS_BASE64 }}" | base64 --decode > "${{ env.KEYSTORE_DIR }}/${{ vars.GH_KEYSTORE_STORE_FILE_PATH }}" | |
- name: Generate google-services.json | |
run: echo "${{ secrets.GOOGLE_SERVICES_BASE64 }}" | base64 --decode > app/google-services.json | |
- name: Build release APK for Github Release | |
run: ./gradlew assembleGithubRelease --no-daemon | |
- name: Generate release notes | |
run: | | |
{ | |
echo 'RELEASE_NOTE<<EOF' | |
awk -v version="${{ github.ref_name }}" '($0 ~ "^## " version "($|[[:space:]])") {p=1;next} /^## / {p=0} p && NF' CHANGELOG.md | |
echo EOF | |
} >> "$GITHUB_ENV" | |
- name: Publish APK on Github Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: app/build/outputs/apk/${{ env.FLAVOR }}/release/*.apk | |
generate_release_notes: true | |
append_body: true | |
body: ${{ env.RELEASE_NOTE }} | |
build_release_google_play: | |
environment: production | |
env: | |
KEYSTORE_DIR: keystore | |
FLAVOR: play | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Generate keystore.properties | |
run: | | |
mkdir -p ${{ env.KEYSTORE_DIR }} && cat << EOF > "${{ env.KEYSTORE_DIR }}/${{ env.FLAVOR }}.properties" | |
storeFile:${{ vars.PLAY_KEYSTORE_STORE_FILE_PATH }} | |
storePassword:${{ secrets.PLAY_KEYSTORE_STORE_PASSWORD }} | |
keyAlias:${{ secrets.PLAY_KEYSTORE_KEY_ALIAS }} | |
keyPassword:${{ secrets.PLAY_KEYSTORE_KEY_PASSWORD }} | |
EOF | |
- name: Generate keystore.jks | |
run: echo "${{ secrets.PLAY_KEYSTORE_JKS_BASE64 }}" | base64 --decode > "${{ env.KEYSTORE_DIR }}/${{ vars.PLAY_KEYSTORE_STORE_FILE_PATH }}" | |
- name: Generate google-services.json | |
run: echo "${{ secrets.GOOGLE_SERVICES_BASE64 }}" | base64 --decode > app/google-services.json | |
- name: Build Release AAB for Google Play | |
run: ./gradlew bundlePlayRelease --no-daemon | |
- name: Upload AAB | |
uses: actions/upload-artifact@v4 | |
with: | |
name: subspace.aab | |
path: app/build/outputs/bundle/${{ env.FLAVOR }}Release/*.aab | |