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 - ZIP
- 7-Zip - 7-Zip
- XZ - XZ
# title:
# description: "Release Title"
# required: true
# default: "WSA"
# type: string
tag: tag:
description: "Release Tag Name" description: "Release Tag Name"
required: true required: true
@ -94,7 +89,7 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
working-directory: ./scripts working-directory: ./scripts
run: | 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 python3 -m pip install requests
cp -r ../wine/.cache/* ~/.cache cp -r ../wine/.cache/* ~/.cache
winetricks msxml6 winetricks msxml6
@ -104,7 +99,7 @@ jobs:
DOWNLOAD_DIR=../download DOWNLOAD_DIR=../download
DOWNLOAD_CONF_NAME=download.list 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 }}]}" ARCH="${opts[ARCH,${{ inputs.arch }}]}"
@ -213,9 +208,7 @@ jobs:
REMOVE_AMAZON="${opts[REMOVE_AMAZON,${{ inputs.remove_amazon }}]}" REMOVE_AMAZON="${opts[REMOVE_AMAZON,${{ inputs.remove_amazon }}]}"
# if [[ "${{ inputs.compression }}" != "ZIP" ]]; then COMPRESSION="--compress --compress-format ${opts[COMPRESSION,${{ inputs.compression }}]}"
# COMPRESSION="--compress --compress-format ${opts[COMPRESSION,${{ inputs.compression }}]}"
# fi
if [[ "${{ inputs.gapps_var }}" == "Custom"* ]]; then if [[ "${{ inputs.gapps_var }}" == "Custom"* ]]; then
echo "Generate Download Links" echo "Generate Download Links"
@ -267,23 +260,11 @@ jobs:
fi fi
echo "release_asset_name=WSA_${{ env.WSA_VER }}_${{ inputs.arch }}$magiskVer$gappsVar${amazon}" >> $GITHUB_ENV echo "release_asset_name=WSA_${{ env.WSA_VER }}_${{ inputs.arch }}$magiskVer$gappsVar${amazon}" >> $GITHUB_ENV
- name: Compress Asset find . -maxdepth 1 -type f -name 'WSA.*' -exec bash -c 'mv "$1" "${{ env.release_asset_name }}.${1##*.}"' _ {} \;
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
- name: Upload Asset - name: Upload Asset
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
files: ./output/${{ env.release_asset_name }}.* files: ./output/${{ env.release_asset_name }}.*
# name: ${{ inputs.title }}
name: WSA name: WSA
tag_name: ${{ inputs.tag }} tag_name: ${{ inputs.tag }}
prerelease: ${{ inputs.prerelease }} prerelease: ${{ inputs.prerelease }}

View File

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