diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 139baae..d10637e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,6 +10,28 @@ env: DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry jobs: + format: + runs-on: ubuntu-latest + timeout-minutes: 10 + + permissions: + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Verify formatting + run: > + dotnet build + -t:CSharpierFormat + --configuration Release + # MAUI Android Build build-android: #runs-on: windows-latest @@ -23,6 +45,7 @@ jobs: strategy: matrix: rid: + - android - android-arm - android-arm64 - android-x86 @@ -35,7 +58,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Cook KeyStore + - name: Create keystore file run: echo "${{ secrets.KEYSTORE_B64 }}" | base64 -d > $GITHUB_WORKSPACE/signing-key.keystore shell: bash @@ -45,7 +68,18 @@ jobs: dotnet-version: 8.0.x - name: Install MAUI Workload - run: dotnet workload install maui --ignore-failed-sources + #run: dotnet workload install maui --ignore-failed-sources + run: dotnet workload install maui-android + + # Setup JDK and Android SDK on Linux + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: 22 + distribution: adopt + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 - name: Restore Dependencies run: dotnet restore Yosu/ @@ -61,25 +95,60 @@ jobs: -p:AndroidSigningKeyAlias="YosuAlias" -p:AndroidSigningKeyPass="${{ secrets.PASSWORD }}" -p:CSharpier_Bypass=true - --runtime ${{ matrix.rid }} + ${{ matrix.rid == 'android' && '' || '--runtime ${{ matrix.rid }}' }} - name: Rename file run: | set -e - mv Yosu/bin/Release/net8.0-android/${{ matrix.rid }}/com.berry.yosu-Signed.apk Yosu.apk + mv Yosu/bin/Release/net8.0-android${{ matrix.rid == 'android' && '' || '/${{ matrix.rid }}' }}/*-Signed.apk Yosu-${{ matrix.rid }}.apk shell: bash - name: Upload Android Artifact uses: actions/upload-artifact@v4 with: name: Yosu-${{ matrix.rid }} - path: Yosu.apk + path: Yosu-${{ matrix.rid }}.apk + + release: + if: ${{ github.ref_type == 'tag' }} + + needs: + - format + - build-android + + runs-on: ubuntu-latest + timeout-minutes: 10 + + permissions: + contents: write + + steps: + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: > + gh release create ${{ github.ref_name }} + --repo ${{ github.event.repository.full_name }} + --title ${{ github.ref_name }} + --generate-notes + --verify-tag deploy: - if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} + #if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }} needs: build-android + + strategy: + matrix: + rid: + - android + - android-arm + - android-arm64 + - android-x86 + - android-x64 + runs-on: ubuntu-latest + permissions: actions: read contents: write