WSABuilds/.github/workflows/build.yaml

183 lines
8.2 KiB
YAML
Raw Normal View History

2022-08-29 23:32:14 +02:00
name: Build MagiskOnWSA
on:
workflow_dispatch:
inputs:
arch:
description: "WSA Architecture"
required: true
2022-08-30 04:05:55 +02:00
default: "x86_64"
2022-08-29 23:32:14 +02:00
type: choice
options:
2022-08-30 04:05:55 +02:00
- x86_64
2022-08-29 23:32:14 +02:00
- AArch64
release_type:
description: "WSA Release Channel"
required: true
default: "Dev Channel"
type: choice
options:
- General Availability Channel
- Release Preview Channel
- Beta Channel
- Dev Channel
magisk_ver:
description: "Magisk Version"
required: true
default: "Stable"
type: choice
options:
- None
- Stable
- Beta
- Canary
- Debug
- Custom (URL)
magisk_url:
description: "Custom Magisk APK/ZIP URL"
required: false
type: string
gapps_var:
description: "GApps Variant"
required: true
default: "Full"
type: choice
options:
- None
- Pico
- Full
- MindTheGapps (URL)
mindthegapps_url:
description: "MindTheGapps ZIP URL"
required: false
type: string
remove_amazon:
description: "Remove Amazon AppStore"
required: false
default: true
type: boolean
offline_mode:
2022-08-30 00:16:15 +02:00
description: "Offline Mode"
2022-08-29 23:32:14 +02:00
required: false
default: false
type: boolean
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
2022-08-30 00:22:15 +02:00
- name: Checkout
uses: actions/checkout@v3
2022-08-29 23:32:14 +02:00
- name: Install Dependencies
2022-08-30 01:10:44 +02:00
working-directory: ./scripts
2022-08-29 23:32:14 +02:00
run: |
sudo apt update && sudo apt -y install setools lzip wine winetricks patchelf e2fsprogs python3-pip aria2
python3 -m pip install requests
cp -r ../wine/.cache/* ~/.cache
winetricks msxml6
- name: Build MagiskOnWSA
2022-08-30 01:10:44 +02:00
working-directory: ./scripts
2022-08-29 23:32:14 +02:00
run: |
DOWNLOAD_DIR=../download
DOWNLOAD_CONF_NAME=download.list
2022-08-30 00:38:06 +02:00
declare -A opts=( ["ARCH,x86_64"]="x64" ["ARCH,AArch64"]="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" ["GAPPS_VAR,None"]="none" ["GAPPS_VAR,Pico"]="pico" ["GAPPS_VAR,Full"]="full" ["GAPPS_VAR,MindTheGapps (URL)"]="MindTheGapps" ["REMOVE_AMAZON,true"]="--remove-amazon" ["REMOVE_AMAZON,false"]="" ["OFFLINE_MODE,true"]="--offline" ["OFFLINE_MODE,false"]="" )
2022-08-30 00:38:06 +02:00
2022-08-29 23:32:14 +02:00
ARCH="${opts[ARCH,${{ inputs.arch }}]}"
2022-08-30 00:38:06 +02:00
2022-08-29 23:32:14 +02:00
RELEASE_TYPE="${opts[RELEASE_TYPE,${{ inputs.release_type }}]}"
2022-08-30 00:38:06 +02:00
2022-08-30 00:35:36 +02:00
if [ "${{inputs.magisk_ver }}" != "None" ]; then
2022-08-29 23:32:14 +02:00
ROOT_SOL="magisk"
if [ "${{ inputs.magisk_ver }}" != "Custom (URL)" ]; then
MAGISK_VER="${opts[MAGISK_VER,${{ inputs.magisk_ver }}]}"
else
echo "${{ inputs.magisk_url }}" > "$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_custom_magisk_download.log" -R --allow-overwrite -d"$DOWNLOAD_DIR" -o magisk-debug.zip -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
echo "Custom Magisk download error!"
exit 1
fi
CUSTOM_MAGISK="1"
MAGISK_VER="${opts[MAGISK_VER,Debug]}"
fi
else
ROOT_SOL="none"
MAGISK_VER="${opts[MAGISK_VER,Stable]}"
fi
2022-08-30 00:38:06 +02:00
2022-08-29 23:32:14 +02:00
if [ "$ARCH" != "arm64" ]; then
2022-08-30 03:24:10 +02:00
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
2022-08-29 23:32:14 +02:00
else
2022-08-30 03:24:10 +02:00
# TODO: keep it 11.0 since official opengapps does not support 12+ yet
# As soon as opengapps is available for 12+, we need to get the sdk/release from build.prop and download the corresponding version
2022-08-30 03:49:47 +02:00
if [ "${{ inputs.gapps_var }}" == "Full" ]; then
2022-08-30 03:24:10 +02:00
GAPPS_VAR="pico"
else
GAPPS_VAR="${opts[GAPPS_VAR,${{ inputs.gapps_var }}]}"
fi
2022-08-29 23:32:14 +02:00
fi
2022-08-30 00:38:06 +02:00
2022-08-30 00:35:36 +02:00
if [ "${{inputs.gapps_var }}" != "None" ]; then
2022-08-29 23:32:14 +02:00
if [ "${{ inputs.gapps_var }}" != "MindTheGapps (URL)" ]; then
GAPPS_BRAND="OpenGApps"
else
echo "${{ inputs.mindthegapps_url }}" > -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"
if ! aria2c --no-conf --log-level=info --log="$DOWNLOAD_DIR/aria2_mindthegapps_download.log" -R --allow-overwrite -d"$DOWNLOAD_DIR" -o MindTheGapps-"$ARCH".zip -i"$DOWNLOAD_DIR"/"$DOWNLOAD_CONF_NAME"; then
echo "MindTheGapps download error!"
exit 1
fi
GAPPS_BRAND="MindTheGapps"
fi
fi
2022-08-30 00:38:06 +02:00
2022-08-29 23:32:14 +02:00
REMOVE_AMAZON="${opts[REMOVE_AMAZON,${{ inputs.remove_amazon }}]}"
2022-08-30 00:38:06 +02:00
2022-08-29 23:32:14 +02:00
OFFLINE_MODE="${opts[OFFLINE_MODE,${{ inputs.offline_mode }}]}"
2022-08-30 00:38:06 +02:00
2022-08-30 01:29:00 +02:00
COMMAND_LINE=(--arch "$ARCH" --release-type "$RELEASE_TYPE" --magisk-ver "$MAGISK_VER" --gapps-brand "$GAPPS_BRAND" --gapps-variant "$GAPPS_VAR" "$REMOVE_AMAZON" --root-sol "$ROOT_SOL" "$COMPRESS_OUTPUT" "$OFFLINE" "$DEBUG" "$CUSTOM_MAGISK")
2022-08-29 23:32:14 +02:00
echo "COMMAND_LINE=${COMMAND_LINE[*]}"
2022-08-30 01:15:17 +02:00
2022-08-30 01:16:56 +02:00
chmod +x ./build.sh
2022-08-29 23:32:14 +02:00
./build.sh "${COMMAND_LINE[@]}"
- name: Generate Release Asset Name
2022-08-30 01:10:44 +02:00
working-directory: ./output
2022-08-29 23:32:14 +02:00
run: |
2022-08-30 02:31:10 +02:00
declare -A magisk_vers=( ["Stable"]="stable" ["Beta"]="beta" ["Canary"]="canary" ["Debug"]="debug" )
2022-08-30 03:55:19 +02:00
if [[ "${{ inputs.magisk_ver }}" == "None" ]]; then
2022-08-29 23:32:14 +02:00
magiskVer=""
2022-08-30 03:55:19 +02:00
elif [[ "${{ inputs.magisk_ver }}" == "Custom (URL)" ]]; then
2022-08-29 23:32:14 +02:00
magiskVer="_Magisk-Custom"
else
2022-08-30 03:06:05 +02:00
magiskVer="_Magisk-$(curl -s https://raw.githubusercontent.com/topjohnwu/magisk-files/master/${magisk_vers[${{ inputs.magisk_ver }}]}.json | jq -r ".magisk.version")"
2022-08-29 23:32:14 +02:00
fi
2022-08-30 03:49:47 +02:00
if [[ "${{ inputs.gapps_var }}" == "None" ]]; then
2022-08-29 23:32:14 +02:00
gappsVar=""
2022-08-30 03:49:47 +02:00
elif [[ "${{ inputs.gapps_var }}" == "MindTheGapps (URL)" ]]; then
2022-08-29 23:32:14 +02:00
gappsVar="_MindTheGapps"
else
2022-08-30 03:24:10 +02:00
gappsVar="_${{ inputs.gapps_var }}-OpenGApps"
2022-08-29 23:32:14 +02:00
fi
2022-08-30 03:24:10 +02:00
if [[ "${{ inputs.remove_amazon }}" == "true" ]]; then
2022-08-29 23:32:14 +02:00
amazon=""
else
amazon="_Amazon-AppStore"
fi
2022-08-30 03:11:27 +02:00
echo "release_asset_name=WSA_${{ env.WSA_VER }}$magiskVer$gappsVar${amazon}_${{ inputs.arch }}" >> $GITHUB_ENV
2022-08-29 23:32:14 +02:00
- name: Compress Asset
2022-08-30 01:10:44 +02:00
working-directory: ./output
2022-08-29 23:32:14 +02:00
run: |
2022-08-30 00:13:07 +02:00
find ./ -maxdepth 1 -type d -not -path './' -exec mv "{}" WSA \;
2022-08-29 23:32:14 +02:00
zip -qrv "${{ env.release_asset_name }}.zip" ./*
- name: Upload Asset
uses: softprops/action-gh-release@v1
with:
2022-08-30 01:12:39 +02:00
files: ./output/${{ env.release_asset_name }}.zip
2022-08-29 23:32:14 +02:00
tag_name: WSA