Skip to content

Commit

Permalink
chore: push to beta channel
Browse files Browse the repository at this point in the history
  • Loading branch information
adityastic committed Jul 4, 2024
1 parent 6007613 commit 8c2c637
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 14 deletions.
55 changes: 44 additions & 11 deletions .github/workflows/branch-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ development ]
pull_request:
branches: [ master, development ]
branches: [ development ]

jobs:
build-android:
Expand All @@ -23,21 +23,52 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v3
if: ${{ github.event_name != 'pull_request' && github.repository == 'fossasia/badgemagic-android' && github.ref == 'refs/heads/master' }}
- name: Setup Ruby
if: ${{ github.event_name != 'pull_request' && github.repository == 'fossasia/badgemagic-android' }}
uses: ruby/setup-ruby@v1
with:
path: |
vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-gems-
ruby-version: '3.3'
bundler-cache: true

- name: Prepare Bundler
if: ${{ github.event_name != 'pull_request' && github.repository == 'fossasia/badgemagic-android' && github.ref == 'refs/heads/master' }}
if: ${{ github.event_name != 'pull_request' && github.repository == 'fossasia/badgemagic-android' }}
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Hydrate and Update Version
id: android-version
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git clone --branch=version --depth=1 https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} version
cd version
# Read and increment version name
IFS='.' read -r major minor patch < versionName.txt
current_patch_version_name="$major.$minor.$patch"
echo "VERSION_NAME=$current_patch_version_name" >> $GITHUB_OUTPUT
next_patch=$((patch + 1))
next_patch_version_name="$major.$minor.$next_patch"
echo "$next_patch_version_name" > versionName.txt
# Read and increment version code
read -r version_code < versionCode.txt
echo "VERSION_CODE=$version_code" >> $GITHUB_OUTPUT
new_version_code=$((version_code + 1))
echo "$new_version_code" > versionCode.txt
# Force push to version branch
git checkout --orphan temporary
git add --all .
git commit -am "[Auto] Update versionName: $next_patch_version_name & versionCode: $new_version_code ($(date +%Y-%m-%d.%H:%M:%S))"
git branch -D version
git branch -m version
git push --force origin version
- name: Pre Checks
run: |
bash scripts/check-screenshots.sh
Expand All @@ -61,6 +92,8 @@ jobs:
STORE_PASS: ${{ secrets.STORE_PASS }}
ALIAS: ${{ secrets.ALIAS }}
KEY_PASS: ${{ secrets.KEY_PASS }}
VERSION_CODE: ${{ steps.android-version.outputs.VERSION_CODE }}
VERSION_NAME: ${{ steps.android-version.outputs.VERSION_NAME }}
run: |
./gradlew build --no-daemon --stacktrace
./gradlew bundleRelease
Expand Down Expand Up @@ -116,7 +149,7 @@ jobs:
git push --force origin apk
- name: Upload alpha version to playstore
if: ${{ github.event_name != 'pull_request' && github.repository == 'fossasia/badgemagic-android' && github.ref == 'refs/heads/master' }}
if: ${{ github.event_name != 'pull_request' && github.repository == 'fossasia/badgemagic-android' }}
run: |
bundle exec fastlane uploadToPlaystore
if [[ $? -ne 0 ]]; then
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ android {
applicationId 'org.fossasia.badgemagic'
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 20
versionName '1.8.10'
versionCode (System.getenv("VERSION_CODE") != null ? System.getenv("VERSION_CODE").toInteger() : 1)
versionName (System.getenv("VERSION_NAME") != null ? System.getenv("VERSION_NAME") : "1.0.0")
vectorDrawables.useSupportLibrary = true
}

Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ platform :android do
gradle(task: "bundle",build_type: "Release")
end
lane :uploadToPlaystore do
upload_to_play_store(track: "alpha",aab:"apk/badge-magic-master-release.aab")
upload_to_play_store(track: "beta",aab:"apk/badge-magic-development-release.aab")
end
end

0 comments on commit 8c2c637

Please sign in to comment.