Skip to content

Fix GitHub actions

Fix GitHub actions #2

name: Publish Android
on:
push:
branches: [ master ]
jobs:
build-and-publish-android:
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: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Decode Keystore
id: decode_keystore
uses: timheuer/[email protected]
with:
fileName: 'motivkey.keystore'
fileDir: ${{ github.workspace }}
encodedString: ${{ secrets.KEYSTORE }}
- name: Set versionCode
run: |
VERSION_CODE=$((GITHUB_RUN_NUMBER + 35))
echo "Setting versionCode to $VERSION_CODE"
sed -i -E "s/versionCode [0-9]+/versionCode $VERSION_CODE/" app/build.gradle
sed -i -E 's/(versionName "[0-9]+\.[0-9]+)\.[0-9]+"/\1.'"$VERSION_CODE"'"/' app/build.gradle
- name: Create signing.properties file
run: |
cat <<EOF > signing.properties
STORE_PASSWORD=${{ secrets.SIGNING_STORE_PASSWORD }}
KEY_ALIAS=${{ secrets.SIGNING_KEY_ALIAS }}
KEY_PASSWORD=${{ secrets.SIGNING_KEY_PASSWORD }}
EOF
- name: Build Android Release
run: ./gradlew :app:assembleRelease
- name: Publish to Google Play
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: de.rakhman.cooking
releaseFiles: 'app/build/outputs/apk/release/app-release.apk'
mappingFile: 'app/build/outputs/mapping/release/mapping.txt'
track: production