This commit is contained in:
Peter Njeim 2022-10-23 03:35:22 -03:00
commit 2a29801fb8
2 changed files with 30 additions and 37 deletions

View File

@ -66,11 +66,6 @@ on:
- ZIP
- 7-Zip
- XZ
# title:
# description: "Release Title"
# required: true
# default: "WSA"
# type: string
tag:
description: "Release Tag Name"
required: true
@ -94,7 +89,7 @@ jobs:
- name: Install Dependencies
working-directory: ./scripts
run: |
sudo apt update && sudo apt -y install setools lzip wine winetricks patchelf e2fsprogs python3-pip aria2 p7zip-full attr xz-utils
sudo apt update && sudo apt -y install setools lzip wine winetricks patchelf e2fsprogs python3-pip aria2 p7zip-full attr xz-utils unzip
python3 -m pip install requests
cp -r ../wine/.cache/* ~/.cache
winetricks msxml6
@ -104,7 +99,7 @@ jobs:
DOWNLOAD_DIR=../download
DOWNLOAD_CONF_NAME=download.list
declare -A opts=( ["ARCH,x86_64"]="x64" ["ARCH,ARM64"]="arm64" ["RELEASE_TYPE,General Availability Channel"]="retail" ["RELEASE_TYPE,Release Preview Channel"]="RP" ["RELEASE_TYPE,Beta Channel"]="WIS" ["RELEASE_TYPE,Dev Channel"]="WIF" ["MAGISK_VER,Stable"]="stable" ["MAGISK_VER,Beta"]="beta" ["MAGISK_VER,Canary"]="canary" ["MAGISK_VER,Debug"]="debug" ["MAGISK_VER,Custom"]="--magisk-custom" ["GAPPS_VAR,None"]="none" ["GAPPS_VAR,Pico"]="pico" ["GAPPS_VAR,Full"]="full" ["REMOVE_AMAZON,true"]="--remove-amazon" ["REMOVE_AMAZON,false"]="" ["COMPRESSION,7-Zip"]="7z" ["COMPRESSION,XZ"]="xz" )
declare -A opts=( ["ARCH,x86_64"]="x64" ["ARCH,ARM64"]="arm64" ["RELEASE_TYPE,General Availability Channel"]="retail" ["RELEASE_TYPE,Release Preview Channel"]="RP" ["RELEASE_TYPE,Beta Channel"]="WIS" ["RELEASE_TYPE,Dev Channel"]="WIF" ["MAGISK_VER,Stable"]="stable" ["MAGISK_VER,Beta"]="beta" ["MAGISK_VER,Canary"]="canary" ["MAGISK_VER,Debug"]="debug" ["MAGISK_VER,Custom"]="--magisk-custom" ["GAPPS_VAR,None"]="none" ["GAPPS_VAR,Pico"]="pico" ["GAPPS_VAR,Full"]="full" ["REMOVE_AMAZON,true"]="--remove-amazon" ["REMOVE_AMAZON,false"]="" ["COMPRESSION,ZIP"]="zip" ["COMPRESSION,7-Zip"]="7z" ["COMPRESSION,XZ"]="xz" )
ARCH="${opts[ARCH,${{ inputs.arch }}]}"
@ -213,9 +208,7 @@ jobs:
REMOVE_AMAZON="${opts[REMOVE_AMAZON,${{ inputs.remove_amazon }}]}"
# if [[ "${{ inputs.compression }}" != "ZIP" ]]; then
# COMPRESSION="--compress --compress-format ${opts[COMPRESSION,${{ inputs.compression }}]}"
# fi
COMPRESSION="--compress --compress-format ${opts[COMPRESSION,${{ inputs.compression }}]}"
if [[ "${{ inputs.gapps_var }}" == "Custom"* ]]; then
echo "Generate Download Links"
@ -267,23 +260,11 @@ jobs:
fi
echo "release_asset_name=WSA_${{ env.WSA_VER }}_${{ inputs.arch }}$magiskVer$gappsVar${amazon}" >> $GITHUB_ENV
- name: Compress Asset
working-directory: ./output
run: |
find ./ -maxdepth 1 -type d -not -path './' -exec mv "{}" WSA \;
if [[ "${{ inputs.compression }}" == "ZIP" ]]; then
zip -qrv "${{ env.release_asset_name }}.zip" ./*
elif [[ "${{ inputs.compression }}" == "7-Zip" ]]; then
7z a "${{ env.release_asset_name }}.7z" ./*
else
tar -cP -I 'xz -9 -T0' -f "${{ env.release_asset_name }}.tar.xz" ./*
fi
find . -maxdepth 1 -type f -name 'WSA.*' -exec bash -c 'mv "$1" "${{ env.release_asset_name }}.${1##*.}"' _ {} \;
- name: Upload Asset
uses: softprops/action-gh-release@v1
with:
files: ./output/${{ env.release_asset_name }}.*
# name: ${{ inputs.title }}
name: WSA
tag_name: ${{ inputs.tag }}
prerelease: ${{ inputs.prerelease }}

View File

@ -152,6 +152,7 @@ ROOT_SOL_MAP=(
COMPRESS_FORMAT_MAP=(
"7z"
"xz"
"zip"
)
ARR_TO_STR() {
@ -844,8 +845,7 @@ else
echo ":warning: Since OpenGApps doesn't officially support Android 12.1 yet, lock the variant to pico!"
fi
fi
artifact_name="WSA${name1}${name2}_${WSA_VER}_${ARCH}_${WSA_REL}"
echo "$artifact_name"
artifact_name="WSA"
echo -e "\nFinishing building...."
if [ -f "$OUTPUT_DIR" ]; then
$SUDO rm -rf "${OUTPUT_DIR:?}"
@ -853,23 +853,35 @@ fi
if [ ! -d "$OUTPUT_DIR" ]; then
mkdir -p "$OUTPUT_DIR"
fi
OUTPUT_PATH="${OUTPUT_DIR:?}/$artifact_name"
if [ "$COMPRESS_OUTPUT" ] || [ -n "$COMPRESS_FORMAT" ]; then
mv "$WORK_DIR/wsa/$ARCH" "$WORK_DIR/wsa/$artifact_name"
if [ "$COMPRESS_FORMAT" = "7z" ]; then
rm -f "${OUTPUT_DIR:?}"/"$artifact_name.7z" || abort
echo "Compressing with 7z"
7z a "$OUTPUT_DIR"/"$artifact_name.7z" "$WORK_DIR/wsa/$artifact_name" || abort
elif [ "$COMPRESS_FORMAT" = "xz" ]; then
rm -f "${OUTPUT_DIR:?}"/"$artifact_name.tar.xz" || abort
echo "Compressing with tar xz"
if ! (tar -cP -I 'xz -9 -T0' -f "$OUTPUT_DIR"/"$artifact_name.tar.xz" "$WORK_DIR/wsa/$artifact_name"); then
echo "Out of memory? Trying again with single threads..."
tar -cPJvf "$OUTPUT_DIR"/"$artifact_name.tar.xz" "$WORK_DIR/wsa/$artifact_name" || abort
if [ -z "$COMPRESS_FORMAT" ]; then
COMPRESS_FORMAT="7z"
fi
if [ -n "$COMPRESS_FORMAT" ]; then
FILE_EXT=".$COMPRESS_FORMAT"
if [ "$FILE_EXT" = ".xz" ]; then
FILE_EXT=".tar$FILE_EXT"
fi
OUTPUT_PATH="$OUTPUT_PATH$FILE_EXT"
fi
rm -f "${OUTPUT_PATH:?}" || abort
if [ "$COMPRESS_FORMAT" = "7z" ]; then
echo "Compressing with 7z"
7z a "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name" || abort
elif [ "$COMPRESS_FORMAT" = "xz" ]; then
echo "Compressing with tar xz"
if ! (tar -cP -I 'xz -9 -T0' -f "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name"); then
echo "Out of memory? Trying again with single threads..."
tar -cPJvf "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name" || abort
fi
elif [ "$COMPRESS_FORMAT" = "zip" ]; then
7z -tzip a "${OUTPUT_PATH:?}" "$WORK_DIR/wsa/$artifact_name" || abort
fi
else
rm -rf "${OUTPUT_DIR:?}/${artifact_name}" || abort
cp -r "$WORK_DIR"/wsa/"$ARCH" "$OUTPUT_DIR/$artifact_name" || abort
rm -rf "${OUTPUT_PATH:?}" || abort
cp -r "$WORK_DIR"/wsa/"$ARCH" "$OUTPUT_PATH" || abort
fi
echo -e "done\n"