-
Notifications
You must be signed in to change notification settings - Fork 1
Keep PNGs in repo to avoid running image gen during all CI #680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c927457
Keep PNGs in repo to avoid running image gen during all CI
mmathieum 77a6bb3
wip
mmathieum a60f3dc
Update shared-modules/app-android/src/main/play/listings/en-US/graphi…
mmathieum 74a0c4e
Update shared-modules/app-android/src/main/play/listings/en-US/graphi…
mmathieum 6acf320
PR comments
mmathieum e36f19b
bump setup action
mmathieum 1a14bbc
wip
mmathieum cdf6b02
wip
mmathieum 3c77283
wip
mmathieum 03109cc
clean
mmathieum 9b1c2c1
image gen workflow
mmathieum 248b2a3
Use git status to compute IMAGE_COUNT for PNG changes
Copilot f13ab61
Align PNG staging with git-based IMAGE_COUNT logic
Copilot fede445
Remove image upload step from mt-image-gen workflow
mmathieum 74bc540
CI triggers
mmathieum 71c5599
fix
mmathieum ca15c15
Merge branch 'master' into mm/ci_image_not_always
mmathieum 5350c97
clean
mmathieum 0f7b708
wip
mmathieum ad3ec3a
latest
mmathieum 9a242f1
wip
mmathieum 6921abd
fix
mmathieum ffc5cca
fix
mmathieum 7a5b3cf
Use git status porcelain for image generation trigger check
Copilot 35f7b84
PR comment
mmathieum 84a37b4
Merge branch 'mm/ci_image_not_always' of github.com:mtransitapps/comm…
mmathieum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
shared-modules/app-android/src/main/res/MTmipmap-MTSTAR/MTmodule_app_icon.MTSTAR.MT.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| #!/bin/bash | ||
| SCRIPT_DIR="$(dirname "$0")"; | ||
|
|
||
| ROOT_DIR="$SCRIPT_DIR/../../../../../../.."; | ||
| COMMONS_DIR="${ROOT_DIR}/commons"; | ||
| source ${COMMONS_DIR}/commons.sh; | ||
|
|
||
| setIsCI; | ||
|
|
||
| setGitProjectName; | ||
|
|
||
| echo ">> Generating mipmap-*/module_app_icon.[png|xml]..."; | ||
|
|
||
| APP_ANDROID_DIR="${ROOT_DIR}/app-android"; | ||
| SRC_DIR="${APP_ANDROID_DIR}/src"; | ||
| MAIN_DIR="${SRC_DIR}/main"; | ||
| RES_DIR="${MAIN_DIR}/res"; | ||
| VALUES_DIR="${RES_DIR}/values" | ||
| mkdir -p "${VALUES_DIR}"; | ||
| checkResult $?; | ||
|
|
||
| ### values/module_app_icon_color.xml - START | ||
|
|
||
| COLOR_FILE_NAME_XML="module_app_icon_color.xml" | ||
| COLOR_FILE_XML="${VALUES_DIR}/${COLOR_FILE_NAME_XML}"; | ||
| if [ -f "${COLOR_FILE_XML}" ]; then | ||
| echo ">> File '$COLOR_FILE_XML' already exist."; # compat with existing values/module_app_icon_color.xml | ||
| else | ||
| requireCommand "xmllint" "libxml2-utils"; | ||
| requireCommand "jq"; | ||
| GTFS_RDS_VALUES_GEN_FILE="$VALUES_DIR/gtfs_rts_values_gen.xml"; # do not change to avoid breaking compat w/ old modules | ||
| BIKE_STATION_VALUES_FILE="$VALUES_DIR/bike_station_values.xml"; | ||
| AGENCY_JSON_FILE="$ROOT_DIR/config/gtfs/agency.json"; | ||
| COLOR="" | ||
| if [ -f $GTFS_RDS_VALUES_GEN_FILE ]; then #1st because color computed | ||
| echo "> Agency file: '$GTFS_RDS_VALUES_GEN_FILE'." | ||
| COLOR=$(xmllint --xpath "//resources/string[@name='gtfs_rts_color']/text()" "$GTFS_RDS_VALUES_GEN_FILE") | ||
| elif [ -f $AGENCY_JSON_FILE ]; then | ||
| echo "> Agency file: '$AGENCY_JSON_FILE'." | ||
| COLOR=$(jq -r '.default_color // empty' "$AGENCY_JSON_FILE") | ||
| elif [ -f $BIKE_STATION_VALUES_FILE ]; then | ||
| echo "> Agency file: '$BIKE_STATION_VALUES_FILE'." | ||
| COLOR=$(xmllint --xpath "//resources/string[@name='bike_station_color']/text()" "$BIKE_STATION_VALUES_FILE") | ||
|
mmathieum marked this conversation as resolved.
|
||
| else | ||
| echo "> No agency file! (rds:$GTFS_RDS_VALUES_GEN_FILE|json:$AGENCY_JSON_FILE|bike:$BIKE_STATION_VALUES_FILE)" | ||
| exit 1 # error | ||
| fi | ||
| echo " - color: $COLOR" | ||
| if [ -z "$COLOR" ]; then | ||
| echo " > No color found for agency type!" | ||
| exit 1 # error | ||
| fi | ||
| rm -f "${COLOR_FILE_XML}"; | ||
| checkResult $?; | ||
| touch "${COLOR_FILE_XML}"; | ||
| checkResult $?; | ||
| cat >>"${COLOR_FILE_XML}" <<EOL | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- DO NOT EDIT: this file is generated by mtransitapps/commons:shared-modules/app-android/src/main/res/MTmipmap-MTSTAR/MTmodule_app_icon.MTSTAR.MT.sh --> | ||
| <resources> | ||
| <color name="module_app_icon_color">#${COLOR}</color> | ||
| </resources> | ||
| EOL | ||
| if [[ ${IS_CI} = true ]]; then | ||
| echo "---------------------------------------------------------------------------------------------------------------" | ||
| cat "${COLOR_FILE_XML}"; #DEBUG | ||
| echo "---------------------------------------------------------------------------------------------------------------" | ||
| fi | ||
|
mmathieum marked this conversation as resolved.
|
||
| fi | ||
|
|
||
| ### values/module_app_icon_color.xml - END | ||
|
|
||
| ### mipmap-anydpi-v26/module_app_icon.xml - START | ||
|
|
||
| FILE_NAME_XML="module_app_icon.xml" | ||
| MIPMAP_ANYDPI="${RES_DIR}/mipmap-anydpi-v26" | ||
| mkdir -p "${MIPMAP_ANYDPI}"; | ||
| checkResult $?; | ||
| FILE_XML="${MIPMAP_ANYDPI}/${FILE_NAME_XML}"; | ||
| if [ -f "${FILE_XML}" ]; then | ||
| echo ">> File '$FILE_XML' already exist."; # compat with existing mipmap-anydpi-v26/module_app_icon.xml | ||
| else | ||
| rm -f "${FILE_XML}"; | ||
| checkResult $?; | ||
| touch "${FILE_XML}"; | ||
| checkResult $?; | ||
| cat >>"${FILE_XML}" <<EOL | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- DO NOT EDIT: this file is generated by mtransitapps/commons:shared-modules/app-android/src/main/res/MTmipmap-MTSTAR/MTmodule_app_icon.MTSTAR.MT.sh --> | ||
| <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <background android:drawable="@color/module_app_icon_color" /> | ||
| <foreground android:drawable="@mipmap/module_app_icon_foreground" /> | ||
| <monochrome android:drawable="@mipmap/ic_launcher_monochrome" /> | ||
| </adaptive-icon> | ||
| EOL | ||
| if [[ ${IS_CI} = true ]]; then | ||
| echo "---------------------------------------------------------------------------------------------------------------" | ||
| cat "${FILE_XML}"; #DEBUG | ||
| echo "---------------------------------------------------------------------------------------------------------------" | ||
| fi | ||
| fi | ||
|
|
||
| $ROOT_DIR/commons-android/pub/module-res-mipmap-launcher-icon-adaptive.sh; | ||
| checkResult $?; | ||
|
mmathieum marked this conversation as resolved.
|
||
|
|
||
| ### mipmap-anydpi-v26/module_app_icon.xml - END | ||
|
|
||
| ### mipmap-*/module_app_icon.png - START | ||
|
|
||
| REQUIRED_ICON_FILE="${MAIN_DIR}/play/listings/en-US/graphics/icon/1.png"; | ||
| if [ ! -f "$REQUIRED_ICON_FILE" ]; then | ||
| $ROOT_DIR/commons/shared-modules/app-android/src/main/play/listings/en-US/graphics/icon/MT1.png.MT.sh; | ||
| checkResult $?; | ||
| fi | ||
|
|
||
| FILE_NAME="module_app_icon.png"; | ||
| for DENSITY in mdpi hdpi xhdpi xxhdpi xxxhdpi; do | ||
| MIPMAP_DIR="${RES_DIR}/mipmap-${DENSITY}" | ||
| FILE_PNG="${MIPMAP_DIR}/${FILE_NAME}" | ||
| mkdir -p "${MIPMAP_DIR}" | ||
| checkResult $?; | ||
| if [ -f "${FILE_PNG}" ]; then | ||
| if [[ ${MT_GENERATE_IMAGES} != true ]]; then | ||
| echo ">> File '$FILE_PNG' already exist."; # compat with existing mipmap-*/module_app_icon.png | ||
| exit 0; # compat w/ manually created file | ||
| else | ||
| echo ">> File '$FILE_PNG' already exist: overriding image... (MT_GENERATE_IMAGES=$MT_GENERATE_IMAGES)"; | ||
| rm -f "${FILE_PNG}"; | ||
| checkResult $?; | ||
| fi | ||
| fi | ||
| done | ||
|
|
||
| $ROOT_DIR/commons-android/pub/module-res-mipmap-launcher-icon.sh; | ||
| checkResult $?; | ||
|
|
||
| ### mipmap-*/module_app_icon.png - END | ||
|
|
||
| echo ">> Generating mipmap-*/module_app_icon.[png|xml]... DONE"; | ||
97 changes: 0 additions & 97 deletions
97
shared-modules/app-android/src/main/res/MTmipmap-MTSTAR/MTmodule_app_icon.png.MT.sh
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.