feat: 适配 .NET6 #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
release_tag: | |
description: '发布标签' | |
required: true | |
type: string | |
primary_version: | |
description: '主发布版本' | |
required: true | |
type: string | |
channels: | |
description: '发布通道' | |
required: true | |
type: string | |
is_test_mode: | |
description: '是否处于测试发布模式' | |
required: false | |
type: boolean | |
jobs: | |
build_app: | |
runs-on: windows-latest # For a list of available runner types, refer to | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
env: | |
artifact_name: out_app_windows_x64_${{ matrix.trim_assets == 'true' && 'trimmed' || 'full' }}_${{ matrix.package }} | |
isTestMode: ${{ github.event.inputs.is_test_mode }} | |
strategy: | |
matrix: | |
trim_assets: ['true', 'false'] | |
package: ['singleFile'] | |
exclude: | |
- package: wap | |
trim_assets: 'true' | |
name: Build_windows_x64_${{ matrix.trim_assets == 'true' && 'trimmed' || 'full' }}_${{ matrix.package }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
ref: ${{ github.event_name != 'workflow_dispatch' && github.ref || github.event.inputs.release_tag }} | |
- name: List files | |
run: ls | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
- name: Setup MSBuild.exe | |
uses: microsoft/[email protected] | |
- name: Build application | |
env: | |
trim_assets: ${{ matrix.trim_assets }} | |
package: ${{ matrix.package }} | |
is_release: ${{ startsWith(github.ref, 'refs/tags/') }} | |
test_signing_key: ${{ secrets.TEST_SIGNING_KEY }} | |
run: | | |
ls | |
if ($env:package -eq "wap") { | |
# WAP | |
pwsh -ep Bypass -c ./tools/release-gen/publish-wap.ps1 false $env:is_release | |
} else { | |
# Single File | |
pwsh -ep Bypass -c ./tools/release-gen/publish.ps1 $env:trim_assets | |
} | |
- name: Upload Unsigned APP to artifacts | |
id: upload-unsigned-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifact_name }} | |
path: | | |
./out/*.zip | |
./out/*.appx | |
build_nupkg: | |
runs-on: windows-latest # For a list of available runner types, refer to | |
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
env: | |
Solution_Name: ClassIsland.sln # Replace with your solution name, i.e. MyWpfApp.sln. | |
# Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. | |
Wap_Project_Directory: ClassIsland/ClassIsland # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. | |
Wap_Project_Path: ClassIsland/ClassIsland/ClassIsland.csproj # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. | |
name: Build Nuget Packages | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
ref: ${{ github.event_name != 'workflow_dispatch' && github.ref || github.event.inputs.release_tag }} | |
- name: List files | |
run: ls | |
# Install the .NET Core workload | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
- name: Setup MSBuild.exe | |
uses: microsoft/[email protected] | |
- name: Build Nuget packages | |
env: | |
is_release: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
ls | |
pwsh -ep Bypass -c ./tools/release-gen/publish-nupkg.ps1 $env:is_release | |
# - name: Upload Nuget packages to GitHub registry | |
# if: ${{ github.event_name != 'pull_request' }} | |
# env: | |
# GHPKG_KEY: ${{ secrets.GHPKG_KEY }} | |
# run: | | |
# dotnet nuget add source --username HelloWRC --password $env:GHPKG_KEY --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ClassIsland/index.json" | |
# dotnet nuget push .\out\*.nupkg -k $env:GHPKG_KEY --source "github" --skip-duplicate | |
- name: Upload Nuget Packages to artifacts | |
if: ${{ !matrix.trim_assets }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: out_nupkgs | |
path: ./out/*.nupkg | |
publish: | |
runs-on: windows-latest | |
env: | |
isTestMode: ${{ github.event.inputs.is_test_mode == true }} | |
if: ${{ github.event.inputs.release_tag && github.event_name != 'pull_request' }} | |
needs: [ build_app, build_nupkg ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
ref: ${{ github.event_name != 'workflow_dispatch' && github.ref || github.event.inputs.release_tag }} | |
- name: Get commit hash | |
uses: prompt/actions-commit-hash@v3 | |
id: commit | |
with: | |
prefix: "${{ github.event.inputs.release_tag }}+" | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./out_artifacts | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.METADATA_DEPLOY_KEY }} | |
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} | |
- name: Upload APP | |
env: | |
GHAPP_PRIVATE_KEY: ${{ secrets.GHAPP_PRIVATE_KEY }} | |
GHAPP_ID: 998668 | |
GHAPP_INSTALLATION_ID: 54893567 | |
ALIST_HOST: ${{ secrets.ALIST_HOST }} | |
ALIST_KEY: ${{ secrets.ALIST_KEY }} | |
primaryVersion: ${{ github.event.inputs.primary_version }} | |
channels: ${{ github.event.inputs.channels }} | |
run: | | |
pwsh -ep Bypass -c ./tools/release-gen/login-github.ps1 | |
pwsh -ep Bypass -c ./tools/release-gen/upload.ps1 | |
# - name: Sentry Release | |
# uses: getsentry/[email protected] | |
# env: | |
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
# SENTRY_ORG: classisland | |
# SENTRY_PROJECT: classisland | |
# SENTRY_URL: ${{ vars.SENTRY_URL }} | |
# with: | |
# environment: production | |
- name: Upload APP to release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "./out/*.zip,./out/*.appx" | |
draft: true | |
bodyFile: ./out/ChangeLogs.md | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.event_name != 'workflow_dispatch' && github.ref || github.event.inputs.release_tag }} |