From 55a4e0490758b40da8f017a5c46fb06067d076c9 Mon Sep 17 00:00:00 2001 From: jerrry08 Date: Sun, 26 Nov 2023 18:10:50 -0400 Subject: [PATCH] Add windows build in workflow --- .github/workflows/main.yml | 46 ++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cdb8503..6434225 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,8 +10,8 @@ env: DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry jobs: - # MAUI Android Build - build-android: + # MAUI Build + build: runs-on: windows-latest env: @@ -19,7 +19,7 @@ jobs: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true - name: Android Build + name: Build & Upload Artifacts steps: - name: Checkout uses: actions/checkout@v3 @@ -57,17 +57,38 @@ jobs: mv Anikin/bin/Release/net8.0-android/com.oneb.anikin-Signed.apk Anikin.apk shell: bash + + # Move the file with windows cmd https://stackoverflow.com/a/7268357 + - name: Move apk file + run: | + if not exist build md build + move Anikin.apk build/Anikin.apk + + - name: Publish MAUI Windows (x64) + run: > + dotnet publish Anikin/ + -c Release + -f net8.0-windows10.0.19041.0 + -p:RuntimeIdentifierOverride=win10-x64 + -p:WindowsPackageType=None + -o build/windows + /p:CSharpier_Bypass=true + + - name: Create windows package + run: powershell Compress-Archive build/windows 'Anikin (windows).zip' - - name: Upload Android Artifact + - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: Anikin - path: Anikin.apk + path: build/ deploy: if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} - needs: build-android + + needs: build runs-on: ubuntu-latest + permissions: actions: read contents: write @@ -83,7 +104,7 @@ jobs: echo $TAG_NAME VERSION="$(echo $TAG_NAME | tr -d v)" echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "PACKAGE_NAME=${{ github.event.repository.name }}-$TAG_NAME.apk" >> $GITHUB_ENV + echo "PACKAGE_NAME=${{ github.event.repository.name }}-$TAG_NAME" >> $GITHUB_ENV Prerelease_Param="" if [[ $TAG_NAME == *"-pre"* || $TAG_NAME == *"-beta"* || $TAG_NAME == *"-alpha"* ]]; then Prerelease_Param="--prerelease" @@ -95,7 +116,7 @@ jobs: uses: actions/download-artifact@v3 with: name: Anikin - path: Anikin + path: build - name: Set body run: | @@ -109,14 +130,15 @@ jobs: run: | set -e - mv Anikin/Anikin.apk ${{ env.PACKAGE_NAME }} + mv build/Anikin.apk ${{ env.PACKAGE_NAME }}.apk + mv 'build/Anikin (windows).zip' '${{ env.PACKAGE_NAME }} (windows).zip' - name: Create release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: > gh release create "${{ github.ref_name }}" - "${{ env.PACKAGE_NAME }}" + "${{ env.PACKAGE_NAME }}.apk" --repo "${{ github.event.repository.full_name }}" --title "${{ env.VERSION }}" --notes "${{ env.TAG_MESSAGE2 }}" @@ -147,7 +169,7 @@ jobs: run: | TAG_NAME="${{ github.ref_name }}" echo "$TAG_NAME" - echo "PACKAGE_NAME=${{ github.event.repository.name }}-$TAG_NAME.apk" >> $GITHUB_ENV + echo "PACKAGE_NAME=${{ github.event.repository.name }}-$TAG_NAME" >> $GITHUB_ENV - name: Set variables 2 run: | @@ -174,5 +196,5 @@ jobs: { "username": "Notifications", "avatar_url": "https://raw.githubusercontent.com/${{ github.event.repository.full_name }}/master/favicon.png", - "content": "**${{ github.event.repository.name }}** new version released!\nVersion: `${{ github.ref_name }}`\n\n${{ env.RELEASE_BODY }}\n\nDownload: <${{ github.event.repository.html_url }}/releases/download/${{ github.ref_name }}/${{ env.PACKAGE_NAME }}>" + "content": "**${{ github.event.repository.name }}** new version released!\nVersion: `${{ github.ref_name }}`\n\n${{ env.RELEASE_BODY }}\n\nDownload: <${{ github.event.repository.html_url }}/releases/download/${{ github.ref_name }}/${{ env.PACKAGE_NAME }}.apk>" } \ No newline at end of file