From 0df5bbbb2ec4c6d477c2d4581a55aa5b04bd3219 Mon Sep 17 00:00:00 2001 From: wxy1343 <49909001+wxy1343@users.noreply.github.com> Date: Thu, 25 Aug 2022 05:41:37 +0800 Subject: [PATCH] Create wsa.yml --- .github/workflows/wsa.yml | 155 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 .github/workflows/wsa.yml diff --git a/.github/workflows/wsa.yml b/.github/workflows/wsa.yml new file mode 100644 index 0000000000..7bfd012da5 --- /dev/null +++ b/.github/workflows/wsa.yml @@ -0,0 +1,155 @@ +name: Build WSA + +on: + workflow_dispatch: + inputs: + arch: + description: "Build arch" + required: true + default: "x64 & arm64" + type: choice + options: + - x64 + - arm64 + - x64 & arm64 + release_type: + description: "WSA release type" + required: true + default: "retail" + type: choice + options: + - retail + - release preview + - insider slow + - insider fast + magisk_apk: + description: "Magisk version" + required: true + default: "stable" + type: choice + options: + - stable + - beta + - canary + - debug + gapps_variant: + description: "Variants of gapps" + required: true + default: "pico" + type: choice + options: + - none + - super + - stock + - full + - mini + - micro + - nano + - pico + - tvstock + - tvmini + remove_amazon: + description: "Remove Amazon AppStore" + required: true + default: "keep" + type: choice + options: + - keep + - remove + root_sol: + description: "Root solution" + required: true + default: "magisk" + type: choice + options: + - magisk + - none +jobs: + matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Generate build matrix + id: set-matrix + uses: actions/github-script@v6 + with: + script: | + let matrix = {}; + let arch = "${{ github.event.inputs.arch }}" + switch ( arch ) { + case "x64": + matrix.arch = ["x64"]; + break; + case "arm64": + matrix.arch = ["arm64"]; + break; + default: + matrix.arch = ["x64", "arm64"]; + break; + } + core.setOutput("matrix",JSON.stringify(matrix)); + + build: + runs-on: ubuntu-latest + needs: matrix + strategy: + matrix: ${{ fromJson(needs.matrix.outputs.matrix) }} + steps: + - uses: actions/checkout@v3 + + - id: run + env: + ARCH: ${{ matrix.arch }} + RELEASE_TYPE: ${{ github.event.inputs.release_type }} + MAGISK_VER: ${{ github.event.inputs.magisk_apk }} + GAPPS_VARIANT: ${{ github.event.inputs.gapps_variant }} + REMOVE_AMAZON: ${{ github.event.inputs.remove_amazon }} + ROOT_SOL: ${{ github.event.inputs.root_sol }} + run: | + ./scripts/run.sh + path=$(find ./output -name "*.7z"|head -n 1) + echo "##[set-output name=path;]$path" + echo "##[set-output name=name;]$(basename $path)" + + - id: vars + run: | + echo "::set-output name=sha_short::$(git rev-parse --short "$GITHUB_SHA")" + + - uses: mukunku/tag-exists-action@v1.0.0 + id: checkTag + with: + tag: ${{ steps.vars.outputs.sha_short }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - id: create_release + uses: actions/create-release@v1 + if: ${{ steps.checkTag.outputs.exists == 'false' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.vars.outputs.sha_short }} + release_name: MagiskOnWSA + draft: false + prerelease: false + + - uses: juliangruber/sleep-action@v1 + with: + time: 10s + + - id: latest_release_info + uses: jossef/action-latest-release-info@v1.1.0 + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.latest_release_info.outputs.upload_url }} + asset_path: ${{ steps.run.outputs.path }} + asset_name: ${{ steps.run.outputs.name }} + asset_content_type: application/x-7z-compressed