Skip to content

Commit

Permalink
actions: smoother release versions (fixes #3762) (#3763)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogi authored Jul 3, 2024
1 parent 6c9d702 commit 37574c1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 37 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ jobs:
diff "$file" "$file.lite" || true
done
- name: diff the code to get lite
if: matrix.build == 'lite'
run: |
ls -al app/build.gradle
sed -i 's/\(versionName "[0-9.]\+\)"/\1-lite"/' app/build.gradle
echo "${{ env.FILES }}" | xargs -n 1 | while read file; do
ls -al $file*
cp "${file}.lite" "$file"
done
- name: setup JDK 17
uses: actions/setup-java@v4
with:
Expand All @@ -59,5 +49,15 @@ jobs:
cache-read-only: false
cache-write-only: false

- name: diff the code to get lite
if: matrix.build == 'lite'
run: |
echo "${{ env.FILES }}" | xargs -n 1 | while read file; do
ls -al $file*
cp "${file}.lite" "$file"
done
ls -al app/build.gradle
sed -i 's/\(versionName "[0-9.]\+\)"/\1-lite"/' app/build.gradle
- name: build debug as test
run: ./gradlew assembleDebug --configuration-cache --no-daemon
40 changes: 15 additions & 25 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,6 @@ jobs:
with:
fetch-depth: 1

- name: expose version from build.gradle
if: matrix.build == 'lite'
uses: dogi/[email protected]
with:
expose-version-name: 'true'

- name: diff the code to get lite
if: matrix.build == 'lite'
run: |
echo "ANDROID_VERSION_NAME_ORIG=${ANDROID_VERSION_NAME}" >> $GITHUB_ENV
ls -al app/build.gradle
sed -i 's/\(versionName "[0-9.]\+\)"/\1-lite"/' app/build.gradle
echo "${{ env.FILES }}" | xargs -n 1 | while read file; do
ls -al $file*
cp "${file}.lite" "$file"
done
- name: expose version from build.gradle
uses: dogi/[email protected]
with:
expose-version-name: 'true'
expose-version-code: 'true'

- name: setup JDK 17
uses: actions/setup-java@v4
with:
Expand All @@ -64,8 +41,21 @@ jobs:
cache-read-only: false
cache-write-only: false

- name: diff the code to get lite
if: matrix.build == 'lite'
run: |
echo "${{ env.FILES }}" | xargs -n 1 | while read file; do
ls -al $file*
cp "${file}.lite" "$file"
done
ls -al app/build.gradle
echo ANDROID_VERSION_LITE=$(grep -oP 'versionName "\K[^\"]+' app/build.gradle) >> $GITHUB_ENV
sed -i 's/\(versionName "[0-9.]\+\)"/\1-lite"/' app/build.gradle
- name: build release APK and AAB
run: |
echo ANDROID_VERSION_NAME=$(grep -oP 'versionName "\K[^\"]+' app/build.gradle) >> $GITHUB_ENV
echo ANDROID_VERSION_CODE=$(grep versionCode app/build.gradle | sed 's/[^0-9]//g') >> $GITHUB_ENV
./gradlew assembleRelease bundleRelease
ls -alR app/build/outputs
mkdir -p sign
Expand Down Expand Up @@ -118,12 +108,12 @@ jobs:
- name: rename APK and AAB with version and branch for artifact
if: github.event_name == 'workflow_dispatch'
run: |
echo "BRANCHNAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
mv output/myPlanet.apk output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.apk
mv output/myPlanet.apk.sha256 output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.apk.sha256
mv output/myPlanet.aab output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.aab
mv output/myPlanet.aab.sha256 output/myPlanet-${{ env.ANDROID_VERSION_NAME }}-${{ env.BRANCHNAME }}.aab.sha256
ls -alR output
echo "BRANCHNAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: upload APK and AAB as build artifact
if: github.event_name == 'workflow_dispatch'
Expand All @@ -140,7 +130,7 @@ jobs:
mv output/myPlanet.apk.sha256 output/myPlanet-lite.apk.sha256
mv output/myPlanet.aab output/myPlanet-lite.aab
mv output/myPlanet.aab.sha256 output/myPlanet-lite.aab.sha256
echo "ANDROID_VERSION_NAME=${ANDROID_VERSION_NAME_ORIG}" >> $GITHUB_ENV
echo "ANDROID_VERSION_NAME=${ANDROID_VERSION_LITE}" >> $GITHUB_ENV
- name: release APK and AAB on GitHub
if: github.event_name != 'workflow_dispatch'
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1650
versionName "0.16.50"
versionCode 1651
versionName "0.16.51"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down

0 comments on commit 37574c1

Please sign in to comment.