This commit is contained in:
Miguel Ángel Barrera 2022-05-16 14:07:13 +02:00
Родитель d730ca16ff
Коммит 15fb5c7567
5 изменённых файлов: 178 добавлений и 252 удалений

Просмотреть файл

@ -7,127 +7,22 @@ on:
- 'src/MobileBlazor/**' - 'src/MobileBlazor/**'
- '**/*build.props' - '**/*build.props'
- '.github/workflows/podcast-dotnet-maui-blazor-cd.yml' - '.github/workflows/podcast-dotnet-maui-blazor-cd.yml'
- '.github/workflows/template-dotnet-maui-cd.yml'
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
env:
ROOT_PATH: src/MobileBlazor/mauiapp/
CSPROJ_PATH: src/MobileBlazor/mauiapp/NetPodsMauiBlazor.csproj
ENCRYPTED_KEYSTORE_PATH: android-keystore-test.jks.gpg # RELATIVE TO github.workspace
KEYSTORE_PATH: android-keystore-test.keystore # RELATIVE TO github.workspace
ARTIFACTS_PATH: artifacts # RELATIVE TO github.workspace
ARTIFACTS_MACOS_PATH: artifacts_macos # RELATIVE TO github.workspace
jobs: jobs:
windows-build-windows: build-mobile:
runs-on: windows-latest uses: ./.github/workflows/template-dotnet-maui-cd.yml
with:
steps: csproj: src/MobileBlazor/mauiapp/NetPodsMauiBlazor.csproj
- uses: actions/checkout@v2 root_path: src/MobileBlazor/mauiapp/
- name: Setup .NET 6 artifacts_macos_path: artifacts_macos
uses: actions/setup-dotnet@v2 encrypted_keystore_path: android-keystore-test.jks.gpg
with: keystore_path: android-keystore-test.keystore
dotnet-version: 6.0.x secrets:
include-prerelease: true android_keystore_gpg_pass: ${{secrets.ANDROID_KEYSTORE_GPG_PASSWORD}}
android_signing_store_pass: ${{secrets.ANDROID_SIGNING_STORE_PASS}}
- name: Add msbuild to PATH android_signing_key_alias: ${{secrets.ANDROID_SIGNING_KEY_ALIAS}}
uses: microsoft/setup-msbuild@v1.1 android_signing_key_pass: ${{secrets.ANDROID_SIGNING_KEY_PASS}}
- name: Install MAUI Workloads
run: |
dotnet workload install maui --source https://api.nuget.org/v3/index.json
# BUILD
- name: Restore dependencies
shell: pwsh
run: |
dotnet restore ${{ env.CSPROJ_PATH }}
- name: Build Maui WinUI project
shell: pwsh
run: |
msbuild "${{ env.CSPROJ_PATH }}" -r -p:Configuration=Release -p:RestorePackages=false -p:TargetFramework=net6.0-windows10.0.19041.0
#POST-BUILD
- name: Publish build artifacts
uses: actions/upload-artifact@v2
with:
name: "WinUI .NET MAUI artifacts"
path: "${{ env.ROOT_PATH }}/bin/Release"
if-no-files-found: error
retention-days: 90
macos-build-android-macos-ios:
runs-on: macos-12
steps:
- uses: actions/checkout@v2
- name: Decrypt keystore
shell: pwsh
run: |
cd ${{ github.workspace }}
gpg --quiet --batch --yes --decrypt --passphrase=${{ secrets.ANDROID_KEYSTORE_GPG_PASSWORD }} --output ${{env.ROOT_PATH}}${{ env.KEYSTORE_PATH }} ${{ env.ENCRYPTED_KEYSTORE_PATH }}
- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
include-prerelease: true
- uses: actions/setup-java@v2
with:
distribution: 'microsoft'
java-version: '11'
- name: Install MAUI Workloads
run: |
dotnet workload install maui --source https://api.nuget.org/v3/index.json
# BUILD
- name: Restore dependencies
shell: pwsh
run: |
dotnet restore ${{ env.CSPROJ_PATH }}
- name: Build MacCatalyst App
shell: bash
run: |
dotnet build ${{ env.CSPROJ_PATH }} -f net6.0-maccatalyst -c Release
dotnet publish ${{ env.CSPROJ_PATH }} -f net6.0-maccatalyst -c Release -p:BuildIpa=True
- name: Build MAUI Android
shell: pwsh
run: |
dotnet publish ${{ env.CSPROJ_PATH }} -c Release -f net6.0-android --no-restore /p:AndroidKeyStore=true /p:AndroidSigningKeyStore=${{ env.KEYSTORE_PATH }} /p:AndroidSigningStorePass=${{ secrets.ANDROID_SIGNING_STORE_PASS }} /p:AndroidSigningKeyAlias=${{ secrets.ANDROID_SIGNING_KEY_ALIAS }} /p:AndroidSigningKeyPass=${{ secrets.ANDROID_SIGNING_KEY_PASS }}
#POST-BUILD
- name: Create artifacts folder
shell: pwsh
run: |
cd ${{ github.workspace }}
mkdir -p ${{ env.ARTIFACTS_MACOS_PATH }}
#TODO add filter and only upload signed artifacts
- name: Copy APKs
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.apk -File -Recurse | Copy-Item -Destination ${{ env.ARTIFACTS_MACOS_PATH }}
- name: Copy AABs
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.aab -File -Recurse | Copy-Item -Destination ${{ env.ARTIFACTS_MACOS_PATH }}
- name: Copy MacOS package
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.pkg -File -Recurse | Copy-Item -Destination ${{ env.ARTIFACTS_MACOS_PATH }}
- name: Publish build artifacts
uses: actions/upload-artifact@v2
with:
name: "Podcast MacOS artifacts"
path: "${{ env.ARTIFACTS_MACOS_PATH }}/*"
if-no-files-found: error
retention-days: 90

133
.github/workflows/podcast-dotnet-maui-cd.yml поставляемый
Просмотреть файл

@ -7,127 +7,22 @@ on:
- 'src/Mobile/**' - 'src/Mobile/**'
- '**/*build.props' - '**/*build.props'
- '.github/workflows/podcast-dotnet-maui-cd.yml' - '.github/workflows/podcast-dotnet-maui-cd.yml'
- '.github/workflows/template-dotnet-maui-cd.yml'
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
env:
ROOT_PATH: src/Mobile/
CSPROJ_PATH: src/Mobile/Microsoft.NetConf2021.Maui.csproj
ENCRYPTED_KEYSTORE_PATH: android-keystore-test.jks.gpg # RELATIVE TO github.workspace
KEYSTORE_PATH: android-keystore-test.keystore # RELATIVE TO github.workspace
ARTIFACTS_PATH: artifacts # RELATIVE TO github.workspace
ARTIFACTS_MACOS_PATH: artifacts_macos # RELATIVE TO github.workspace
jobs: jobs:
windows-build-windows: build-mobile:
runs-on: windows-latest uses: ./.github/workflows/template-dotnet-maui-cd.yml
with:
steps: csproj: src/Mobile/Microsoft.NetConf2021.Maui.csproj
- uses: actions/checkout@v2 root_path: src/Mobile/
- name: Setup .NET 6 artifacts_macos_path: artifacts_macos
uses: actions/setup-dotnet@v2 encrypted_keystore_path: android-keystore-test.jks.gpg
with: keystore_path: android-keystore-test.keystore
dotnet-version: 6.0.x secrets:
include-prerelease: true android_keystore_gpg_pass: ${{secrets.ANDROID_KEYSTORE_GPG_PASSWORD}}
android_signing_store_pass: ${{secrets.ANDROID_SIGNING_STORE_PASS}}
- name: Add msbuild to PATH android_signing_key_alias: ${{secrets.ANDROID_SIGNING_KEY_ALIAS}}
uses: microsoft/setup-msbuild@v1.1 android_signing_key_pass: ${{secrets.ANDROID_SIGNING_KEY_PASS}}
- name: Install MAUI Workloads
run: |
dotnet workload install maui --source https://api.nuget.org/v3/index.json
# BUILD
- name: Restore dependencies
shell: pwsh
run: |
dotnet restore ${{ env.CSPROJ_PATH }}
- name: Build Maui WinUI project
shell: pwsh
run: |
msbuild "${{ env.CSPROJ_PATH }}" -r -p:Configuration=Release -p:RestorePackages=false -p:TargetFramework=net6.0-windows10.0.19041.0
#POST-BUILD
- name: Publish build artifacts
uses: actions/upload-artifact@v2
with:
name: "WinUI .NET MAUI artifacts"
path: "${{ env.ROOT_PATH }}/bin/Release"
if-no-files-found: error
retention-days: 90
macos-build-android-macos-ios:
runs-on: macos-12
steps:
- uses: actions/checkout@v2
- name: Decrypt keystore
shell: pwsh
run: |
cd ${{ github.workspace }}
gpg --quiet --batch --yes --decrypt --passphrase=${{ secrets.ANDROID_KEYSTORE_GPG_PASSWORD }} --output ${{env.ROOT_PATH}}${{ env.KEYSTORE_PATH }} ${{ env.ENCRYPTED_KEYSTORE_PATH }}
- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
include-prerelease: true
- uses: actions/setup-java@v2
with:
distribution: 'microsoft'
java-version: '11'
- name: Install MAUI Workloads
run: |
dotnet workload install maui --source https://api.nuget.org/v3/index.json
# BUILD
- name: Restore dependencies
shell: pwsh
run: |
dotnet restore ${{ env.CSPROJ_PATH }}
- name: Build MacCatalyst App
shell: bash
run: |
dotnet build ${{ env.CSPROJ_PATH }} -f net6.0-maccatalyst -c Release
dotnet publish ${{ env.CSPROJ_PATH }} -f net6.0-maccatalyst -c Release -p:BuildIpa=True
- name: Build MAUI Android
shell: pwsh
run: |
dotnet publish ${{ env.CSPROJ_PATH }} -c Release -f net6.0-android --no-restore /p:AndroidKeyStore=true /p:AndroidSigningKeyStore=${{ env.KEYSTORE_PATH }} /p:AndroidSigningStorePass=${{ secrets.ANDROID_SIGNING_STORE_PASS }} /p:AndroidSigningKeyAlias=${{ secrets.ANDROID_SIGNING_KEY_ALIAS }} /p:AndroidSigningKeyPass=${{ secrets.ANDROID_SIGNING_KEY_PASS }}
#POST-BUILD
- name: Create artifacts folder
shell: pwsh
run: |
cd ${{ github.workspace }}
mkdir -p ${{ env.ARTIFACTS_MACOS_PATH }}
#TODO add filter and only upload signed artifacts
- name: Copy APKs
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.apk -File -Recurse | Copy-Item -Destination ${{ env.ARTIFACTS_MACOS_PATH }}
- name: Copy AABs
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.aab -File -Recurse | Copy-Item -Destination ${{ env.ARTIFACTS_MACOS_PATH }}
- name: Copy MacOS package
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.pkg -File -Recurse | Copy-Item -Destination ${{ env.ARTIFACTS_MACOS_PATH }}
- name: Publish build artifacts
uses: actions/upload-artifact@v2
with:
name: "Podcast MacOS artifacts"
path: "${{ env.ARTIFACTS_MACOS_PATH }}/*"
if-no-files-found: error
retention-days: 90

140
.github/workflows/template-dotnet-maui-cd.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,140 @@
on:
workflow_call:
inputs:
csproj:
required: true
type: string
root_path:
required: true
type: string
artifacts_macos_path:
required: true
type: string
encrypted_keystore_path:
required: true
type: string
keystore_path:
required: true
type: string
secrets:
android_keystore_gpg_pass:
required: true
android_signing_store_pass:
required: true
android_signing_key_alias:
required: true
android_signing_key_pass:
required: true
jobs:
windows-build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
include-prerelease: true
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Install MAUI Workloads
run: |
dotnet workload install maui --source https://api.nuget.org/v3/index.json
# BUILD
- name: Restore dependencies
shell: pwsh
run: |
dotnet restore ${{ inputs.csproj }}
- name: Build Maui WinUI project
shell: pwsh
run: |
msbuild "${{ inputs.csproj }}" -r -p:Configuration=Release -p:RestorePackages=false -p:TargetFramework=net6.0-windows10.0.19041.0
#POST-BUILD
- name: Publish build artifacts
uses: actions/upload-artifact@v2
with:
name: "WinUI .NET MAUI artifacts"
path: "${{ inputs.root_path }}/bin/Release"
if-no-files-found: error
retention-days: 90
macos-build-android-macos-ios:
runs-on: macos-12
steps:
- uses: actions/checkout@v2
- name: Decrypt keystore
shell: pwsh
run: |
cd ${{ github.workspace }}
gpg --quiet --batch --yes --decrypt --passphrase=${{ secrets.android_keystore_gpg_pass }} --output ${{inputs.root_path}}${{ inputs.keystore_path }} ${{ inputs.encrypted_keystore_path }}
- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
include-prerelease: true
- uses: actions/setup-java@v2
with:
distribution: 'microsoft'
java-version: '11'
- name: Install MAUI Workloads
run: |
dotnet workload install maui --source https://api.nuget.org/v3/index.json
# BUILD
- name: Restore dependencies
shell: pwsh
run: |
dotnet restore ${{ inputs.csproj }}
- name: Build MacCatalyst App
shell: bash
run: |
dotnet build ${{ inputs.csproj }} -f net6.0-maccatalyst -c Release
dotnet publish ${{ inputs.csproj }} -f net6.0-maccatalyst -c Release -p:BuildIpa=True
- name: Build MAUI Android
shell: pwsh
run: |
dotnet publish ${{ inputs.csproj }} -c Release -f net6.0-android --no-restore /p:AndroidKeyStore=true /p:AndroidSigningKeyStore=${{ inputs.keystore_path }} /p:AndroidSigningStorePass=${{ secrets.android_signing_store_pass }} /p:AndroidSigningKeyAlias=${{ secrets.android_signing_key_alias }} /p:AndroidSigningKeyPass=${{ secrets.android_signing_key_pass }}
#POST-BUILD
- name: Create artifacts folder
shell: pwsh
run: |
cd ${{ github.workspace }}
mkdir -p ${{ inputs.artifacts_macos_path }}
#TODO add filter and only upload signed artifacts
- name: Copy APKs
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.apk -File -Recurse | Copy-Item -Destination ${{ inputs.artifacts_macos_path }}
- name: Copy AABs
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.aab -File -Recurse | Copy-Item -Destination ${{ inputs.artifacts_macos_path }}
- name: Copy MacOS package
shell: pwsh
run: |
Get-Childitem –Path ${{ github.workspace }} -Include *.pkg -File -Recurse | Copy-Item -Destination ${{ inputs.artifacts_macos_path }}
- name: Publish build artifacts
uses: actions/upload-artifact@v2
with:
name: "Podcast MacOS artifacts"
path: "${{ inputs.artifacts_macos_path }}/*"
if-no-files-found: error
retention-days: 90

20
.github/workflows/template-dotnet-maui-ci.yml поставляемый
Просмотреть файл

@ -12,24 +12,20 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install .NET 6 - name: Setup .NET 6
shell: pwsh uses: actions/setup-dotnet@v2
run: | with:
$ProgressPreference = 'SilentlyContinue' dotnet-version: 6.0.x
Invoke-WebRequest https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1 include-prerelease: true
.\dotnet-install.ps1 -Channel 6.0.3xx -Quality daily -InstallDir .
- name: Install MAUI workload - name: Install MAUI Workloads
shell: pwsh
run: | run: |
$ProgressPreference = 'SilentlyContinue' dotnet workload install maui --source https://api.nuget.org/v3/index.json
Invoke-WebRequest https://raw.githubusercontent.com/dotnet/maui/main/NuGet.config -OutFile maui-main-NuGet.config
& .\dotnet workload install maui --from-rollback-file https://aka.ms/dotnet/maui/main.json --configfile maui-main-NuGet.config
- name: Build MAUI Mobile app - name: Build MAUI Mobile app
shell: pwsh shell: pwsh
run: | run: |
& .\dotnet build ${{inputs.csproj}} -bl:mobile.binlog dotnet build ${{inputs.csproj}} -bl:mobile.binlog
- name: Archive build log - name: Archive build log
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2