Updated github gradle action version #26
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: Generate release APK and AAB | |
on: | |
push: | |
branches: [ "release/*/*" ] | |
jobs: | |
apk: | |
name: Generate release builds | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Decode keystore and create jks | |
run: echo "${{ secrets.KEY_KEYSTORE_BASE64 }}" | base64 --decode > app/keystore.jks | |
- name: Generate keystore.properties | |
run: | | |
cat <<EOF > keystore.properties | |
PEXELS_API_KEY=${{ secrets.PEXELS_API_KEY }} | |
KEY_PASSWORD=${{ secrets.KEY_PASSWORD }} | |
KEY_ALIAS=${{ secrets.KEY_ALIAS }} | |
KEYSTORE_FILE=${{ secrets.KEYSTORE_FILE }} | |
EOF | |
- name: Generate file name env var | |
run: | | |
DATE=$(date +'%d.%m.%Y-%H%M%S') | |
BRANCH_NAME=${GITHUB_REF##*/} | |
MESSAGE=$(cat << EOF | |
PurrfectPics-release-${BRANCH_NAME}-${DATE} | |
EOF) | |
echo OUTPUT_NAME=$MESSAGE >> $GITHUB_ENV | |
- name: Build release APK | |
run: bash ./gradlew assembleRelease --stacktrace | |
- name: Rename APK | |
run: | |
mv "./app/build/outputs/apk/release/app-release.apk" "./app/build/outputs/apk/release/${{ env.OUTPUT_NAME }}.apk" | |
- name: Upload release APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.OUTPUT_NAME }}-APK | |
path: app/build/outputs/apk/release/${{ env.OUTPUT_NAME }}.apk | |
- name: Build release AAB | |
run: bash ./gradlew bundleRelease --stacktrace | |
- name: Rename AAB | |
run: | |
mv "./app/build/outputs/bundle/release/app-release.aab" "./app/build/outputs/bundle/release/${{ env.OUTPUT_NAME }}.aab" | |
- name: Upload release AAB | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.OUTPUT_NAME }}-AAB | |
path: app/build/outputs/bundle/release/${{ env.OUTPUT_NAME }}.aab | |
- name: Merge Artifacts | |
uses: actions/upload-artifact/merge@v4 | |
with: | |
name: merged-release-artifacts | |
pattern: ${{ env.OUTPUT_NAME }}-* | |
delete-merged: true |