mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
We refactored our dummy_bundle.yml
workflow to generate the dummy bundle and APKs based on a specified date, using a new tag format dummy_bundle_and_apk_v*
, where *
is replaced by the date in YYYY_MM_DD
. This date is extracted and set as an environment variable to generate the app bundle and APK for that date, defaulting to the current date if no date is provided.
* Now, our `dummy_bundle.yml` will generate both the app bundle and APKs, so if we need the APK for a specified date, we can easily retrieve it. * Added comments in both workflows to understand the flow of the workflows.
This commit is contained in:
parent
ae7988f112
commit
a371ae6d67
50
.github/workflows/dummy_bundle.yml
vendored
50
.github/workflows/dummy_bundle.yml
vendored
@ -1,50 +0,0 @@
|
||||
name: Generate dummy bundle
|
||||
|
||||
# The workflow will trigger when the `dummy_bundle` tag is pushed.
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'dummy_bundle' # dummy_bundle Tag
|
||||
|
||||
jobs:
|
||||
publish_dummy_bundle:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Preparing signing material
|
||||
env:
|
||||
KEYSTORE: ${{ secrets.keystore }}
|
||||
run: |
|
||||
echo "$KEYSTORE" | base64 -d > kiwix-android.keystore
|
||||
|
||||
- name: Generate dummy Bundle
|
||||
env:
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||
run: |
|
||||
./gradlew bundlePlayStore --scan
|
||||
|
||||
|
||||
- name: Get Bundle name and path
|
||||
id: bundle-path
|
||||
run: |
|
||||
BUNDLE_PATH="app/build/outputs/bundle/playStore/kiwix-playStore.aab"
|
||||
BUNDLE_NAME="PlayStoreDummyBundle.aab"
|
||||
echo "bundle_path=$BUNDLE_PATH" >> $GITHUB_ENV
|
||||
echo "bundle_name=$BUNDLE_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload Bundle as an artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.bundle_name }}
|
||||
path: ${{ env.bundle_path }}
|
||||
|
76
.github/workflows/dummy_bundle_and_apk.yml
vendored
Normal file
76
.github/workflows/dummy_bundle_and_apk.yml
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
name: Generate dummy bundle and APK
|
||||
|
||||
# This workflow will trigger when the 'dummy_bundle_and_apk' or 'dummy_bundle_and_apk_v*' tag is pushed.
|
||||
# In 'dummy_bundle_and_apk_v*', '*' is a dynamic date pushed in the tag.
|
||||
# The date format should be YYYY-MM-DD (e.g., 2024-12-18).
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'dummy_bundle_and_apk' # dummy_bundle_and_apk Tag.
|
||||
- 'dummy_bundle_and_apk_v*' # Trigger for generating dummy bundle and APKs with dynamic date.
|
||||
|
||||
jobs:
|
||||
publish_dummy_bundle_and_apk:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: temurin
|
||||
|
||||
- name: Preparing signing material
|
||||
env:
|
||||
KEYSTORE: ${{ secrets.keystore }}
|
||||
run: |
|
||||
echo "$KEYSTORE" | base64 -d > kiwix-android.keystore
|
||||
|
||||
- name: Retrieve date from TAG
|
||||
id: extract_date
|
||||
run: |
|
||||
# Check if the tag matches the pattern 'dummy_bundle_and_apk_vYYYY-MM-DD'.
|
||||
# If the date is found in the tag, it will be extracted and set as the RELEASE_DATE.
|
||||
# If no date is found or the tag does not match, an empty string will be set for RELEASE_DATE,
|
||||
# and Android will generate the APK and app bundle for the current date.
|
||||
if [[ "${GITHUB_REF}" =~ dummy_bundle_and_apk_v([0-9]{4}-[0-9]{2}-[0-9]{2}) ]]; then
|
||||
RELEASE_DATE="${BASH_REMATCH[1]}"
|
||||
else
|
||||
RELEASE_DATE=""
|
||||
fi
|
||||
echo "KIWIX_ANDROID_RELEASE_DATE=$RELEASE_DATE" >> $GITHUB_ENV
|
||||
|
||||
- name: Generate dummy Bundle and APKs
|
||||
env:
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||
KIWIX_ANDROID_RELEASE_DATE: ${{ env.KIWIX_ANDROID_RELEASE_DATE }}
|
||||
run: |
|
||||
./gradlew bundlePlayStore assembleRelease --scan
|
||||
|
||||
|
||||
- name: Get Bundle and APKs name and path
|
||||
id: get-bundle-and-apk-paths
|
||||
run: |
|
||||
BUNDLE_PATH="app/build/outputs/bundle/playStore/kiwix-playStore.aab"
|
||||
BUNDLE_NAME="PlayStoreDummyBundle.aab"
|
||||
echo "bundle_path=$BUNDLE_PATH" >> $GITHUB_ENV
|
||||
echo "bundle_name=$BUNDLE_NAME" >> $GITHUB_ENV
|
||||
APK_DIR="app/build/outputs/apk/release/"
|
||||
echo "apk_dir=$APK_DIR" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload Bundle as an artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.bundle_name }}
|
||||
path: ${{ env.bundle_path }}
|
||||
|
||||
- name: Upload All Release APKs as artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ReleaseApks
|
||||
path: ${{ env.apk_dir }}*.apk
|
||||
|
8
.github/workflows/testing_release.yml
vendored
8
.github/workflows/testing_release.yml
vendored
@ -1,6 +1,8 @@
|
||||
name: Publish App to Play Store
|
||||
|
||||
# Trigger the workflow on a schedule (every Monday at 12:00 UTC)
|
||||
# This workflow is triggered on a schedule or when specific tags are pushed.
|
||||
# It runs every Monday at 12:00 UTC and also when the 'internal_testing' or 'internal_testing_v*' tag is pushed.
|
||||
# In 'internal_testing_v*', '*' represents a dynamic date (e.g., 2024-12-18).
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 12 * * 1' # Runs every Monday at 12:00
|
||||
@ -33,6 +35,10 @@ jobs:
|
||||
- name: Retrieve date from TAG
|
||||
id: extract_date
|
||||
run: |
|
||||
# Check if the tag matches the pattern 'internal_testing_vYYYY-MM-DD'.
|
||||
# If the date is found in the tag, it will be extracted and set as the RELEASE_DATE.
|
||||
# If no date is found or the tag does not match, an empty string will be set for RELEASE_DATE.
|
||||
# Android will use the current date for the APK generation.
|
||||
if [[ "${GITHUB_REF}" =~ internal_testing_v([0-9]{4}-[0-9]{2}-[0-9]{2}) ]]; then
|
||||
RELEASE_DATE="${BASH_REMATCH[1]}"
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user