Skip to content

Commit

Permalink
Update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jerry08 committed Oct 8, 2024
1 parent ab71dd1 commit 77ff143
Showing 1 changed file with 75 additions and 6 deletions.
81 changes: 75 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,6 +45,7 @@ jobs:
strategy:
matrix:
rid:
- android
- android-arm
- android-arm64
- android-x86
Expand All @@ -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

Expand All @@ -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/
Expand All @@ -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
Expand Down

0 comments on commit 77ff143

Please sign in to comment.