better latest tag fetching

This commit is contained in:
j-hc 2023-02-05 11:05:22 +03:00
parent 55c89ded53
commit 2f5291421e
3 changed files with 17 additions and 11 deletions

View File

@ -17,10 +17,19 @@ jobs:
fetch-depth: 0
submodules: true
- name: Get last tag
id: last_tag
uses: oprypin/find-latest-tag@v1
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
releases-only: true
- name: Get next version code
id: next_ver_code
run: |
TAG=$(git tag --sort=creatordate | tail -1)
TAG="${{ steps.last_tag.outputs.tag }}"
if [ -z "$TAG" ]; then TAG=0; fi
echo "NEXT_VER_CODE=$((TAG + 1))" >> $GITHUB_OUTPUT
@ -58,12 +67,10 @@ jobs:
file_glob: true
overwrite: false
- name: Switch to update branch
run: git checkout -f update || git switch --discard-changes --orphan update
- name: Update changelog and Magisk update jsons
- name: Update changelog and Magisk update json
id: update_config
run: |
git checkout -f update || git switch --discard-changes --orphan update
cp -f build.tmp build.md
get_update_json() {
echo "{

View File

@ -21,6 +21,8 @@ vtf() {
}
toml_prep "$(cat 2>/dev/null "${1:-config.toml}")" || abort "could not find config file '${1}'"
# -- Main config --
main_config_t=$(toml_get_table "")
COMPRESSION_LEVEL=$(toml_get "$main_config_t" compression-level) || abort "ERROR: compression-level is missing"
ENABLE_MAGISK_UPDATE=$(toml_get "$main_config_t" enable-magisk-update) || abort "ERROR: enable-magisk-update is missing"
@ -35,13 +37,13 @@ RV_BRAND_F=${RV_BRAND,,}
RV_BRAND_F=${RV_BRAND_F// /-}
PREBUILTS_DIR="${TEMP_DIR}/tools-${RV_BRAND_F}"
mkdir -p "$BUILD_DIR" "$PREBUILTS_DIR"
# -- Main config --
if ((COMPRESSION_LEVEL > 9)) || ((COMPRESSION_LEVEL < 0)); then abort "compression-level must be from 0 to 9"; fi
if [ "${DRYRUN:-}" = true ]; then set_prebuilts; else get_prebuilts || set_prebuilts; fi
if [ "$BUILD_MINDETACH_MODULE" = true ]; then : >$PKGS_LIST; fi
if [ "$LOGGING_F" = true ]; then mkdir -p logs; fi
jq --version >/dev/null || abort "\`jq\` is not installed. install it with 'apt install jq' or equivalent"
get_cmpr
log "**App Versions:**"
idx=0
@ -61,7 +63,7 @@ for table_name in $(toml_get_table_names); do
app_args[allow_alpha_version]=$(toml_get "$t" allow-alpha-version) && vtf "${app_args[allow_alpha_version]}" "allow-alpha-version" || app_args[allow_alpha_version]=false
app_args[build_mode]=$(toml_get "$t" build-mode) && {
if ! isoneof "${app_args[build_mode]}" both apk module; then
abort "ERROR: '${app_args[build_mode]}' is not a valid option for '${table_name}': only 'both', 'apk' or 'module' is allowed"
abort "ERROR: build-mode '${app_args[build_mode]}' is not a valid option for '${table_name}': only 'both', 'apk' or 'module' is allowed"
fi
} || app_args[build_mode]=apk
app_args[uptodown_dlurl]=$(toml_get "$t" uptodown-dlurl) && {
@ -79,7 +81,7 @@ for table_name in $(toml_get_table_names); do
fi
app_args[arch]=$(toml_get "$t" arch) && {
if ! isoneof "${app_args[arch]}" all arm64-v8a arm-v7a; then
abort "ERROR: '${app_args[arch]}' is not a valid option for 'arch': only 'all', 'arm64-v8a', 'arm-v7a' is allowed"
abort "ERROR: arch '${app_args[arch]}' is not a valid option for '${table_name}': only 'all', 'arm64-v8a', 'arm-v7a' is allowed"
fi
} || app_args[arch]="all"
app_args[module_prop_name]=$(toml_get "$t" module-prop-name) || {

View File

@ -68,9 +68,6 @@ get_prebuilts() {
if [ "$(uname -m)" = aarch64 ]; then arch=arm64; else arch=arm; fi
dl_if_dne ${TEMP_DIR}/aapt2 https://github.com/rendiix/termux-aapt/raw/main/prebuilt-binary/${arch}/aapt2
fi
}
get_cmpr() {
mkdir -p ${MODULE_TEMPLATE_DIR}/bin/arm64 ${MODULE_TEMPLATE_DIR}/bin/arm
dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm64/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-arm64-v8a"
dl_if_dne "${MODULE_TEMPLATE_DIR}/bin/arm/cmpr" "https://github.com/j-hc/cmpr/releases/latest/download/cmpr-armeabi-v7a"