mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 02:36:24 -04:00
Added logs to check whether the environment variable is set, for debugging purposes.
* Improved the ID of the "Retrieve date from git revision" job. * Removed unnecessary conditions from the workflow.
This commit is contained in:
parent
befd7d389a
commit
0ec90f06b0
11
.github/workflows/dummy_bundle_and_apk.yml
vendored
11
.github/workflows/dummy_bundle_and_apk.yml
vendored
@ -26,15 +26,10 @@ jobs:
|
||||
echo "$KEYSTORE" | base64 -d > kiwix-android.keystore
|
||||
|
||||
- name: Retrieve date from git revision
|
||||
id: git_date
|
||||
id: git_head_revision_date
|
||||
run: |
|
||||
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d || echo "NoCommits")
|
||||
if [ "$DATE" = "NoCommits" ]; then
|
||||
RELEASE_DATE=""
|
||||
else
|
||||
RELEASE_DATE="$DATE"
|
||||
fi
|
||||
echo "KIWIX_ANDROID_RELEASE_DATE=$RELEASE_DATE" >> $GITHUB_ENV
|
||||
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d)
|
||||
echo "KIWIX_ANDROID_RELEASE_DATE=$DATE" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Generate dummy Bundle and APKs
|
||||
|
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@ -22,15 +22,10 @@ jobs:
|
||||
run: echo "TAG=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
|
||||
|
||||
- name: Retrieve date from git revision
|
||||
id: git_date
|
||||
id: git_head_revision_date
|
||||
run: |
|
||||
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d || echo "NoCommits")
|
||||
if [ "$DATE" = "NoCommits" ]; then
|
||||
RELEASE_DATE=""
|
||||
else
|
||||
RELEASE_DATE="$DATE"
|
||||
fi
|
||||
echo "KIWIX_ANDROID_RELEASE_DATE=$RELEASE_DATE" >> $GITHUB_ENV
|
||||
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d)
|
||||
echo "KIWIX_ANDROID_RELEASE_DATE=$DATE" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Retrieve secrets to files
|
||||
|
11
.github/workflows/testing_release.yml
vendored
11
.github/workflows/testing_release.yml
vendored
@ -31,15 +31,10 @@ jobs:
|
||||
echo "$PLAYSTORE_JSON" > playstore.json
|
||||
|
||||
- name: Retrieve date from git revision
|
||||
id: git_date
|
||||
id: git_head_revision_date
|
||||
run: |
|
||||
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d || echo "NoCommits")
|
||||
if [ "$DATE" = "NoCommits" ]; then
|
||||
RELEASE_DATE=""
|
||||
else
|
||||
RELEASE_DATE="$DATE"
|
||||
fi
|
||||
echo "KIWIX_ANDROID_RELEASE_DATE=$RELEASE_DATE" >> $GITHUB_ENV
|
||||
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d)
|
||||
echo "KIWIX_ANDROID_RELEASE_DATE=$DATE" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Publish bundle in internal testing on Google Play
|
||||
|
@ -37,9 +37,13 @@ fun String.getVersionCode(): Int {
|
||||
// Otherwise, it generates the version code based on the current date.
|
||||
// See https://github.com/kiwix/kiwix-android/issues/4120 for more details.
|
||||
val currentDate = if (!System.getenv("KIWIX_ANDROID_RELEASE_DATE").isNullOrEmpty()) {
|
||||
LocalDate.parse(System.getenv("KIWIX_ANDROID_RELEASE_DATE"))
|
||||
LocalDate.parse(System.getenv("KIWIX_ANDROID_RELEASE_DATE")).also {
|
||||
println("Environment variable found. Using date: $it for version code generation.")
|
||||
}
|
||||
} else {
|
||||
LocalDate.now()
|
||||
LocalDate.now().also {
|
||||
println("No environment variable found. Using current date: $it for version code generation.")
|
||||
}
|
||||
}
|
||||
// Calculate the number of days between the LAST_DATE and today's date.
|
||||
// This gives us the total number of days since the last version code was set.
|
||||
|
Loading…
x
Reference in New Issue
Block a user