feat: manually managing pack, publish & deploy workflows.

This commit is contained in:
Zhang Dian
2024-12-28 20:05:27 +08:00
parent e53e41614c
commit 58e1ef5b66
3 changed files with 60 additions and 21 deletions

View File

@@ -4,10 +4,7 @@ env:
PROJECT_PATH: demo/Ursa.Demo.Browser/Ursa.Demo.Browser.csproj PROJECT_PATH: demo/Ursa.Demo.Browser/Ursa.Demo.Browser.csproj
OUTPUT_PATH: demo/Ursa.Demo.Browser/bin/Release/net8.0-browser/publish/wwwroot OUTPUT_PATH: demo/Ursa.Demo.Browser/bin/Release/net8.0-browser/publish/wwwroot
on: on:
push: workflow_dispatch:
branches: [ "action/deploy" ]
pull_request:
branches: [ "action/deploy" ]
jobs: jobs:
deploy-to-github-pages: deploy-to-github-pages:
@@ -28,7 +25,7 @@ jobs:
run: dotnet publish $PROJECT_PATH -c Release --nologo run: dotnet publish $PROJECT_PATH -c Release --nologo
- name: Change base-tag in index.html - name: Change base-tag in index.html
run: sed -i 's/<base href="\/" \/>/<base href="\/Ursa.Avalonia\/" \/>/g' $OUTPUT_PATH/index.html run: sed -i 's#<base href="/" />#<base href="/Ursa.Avalonia/" />#g' $OUTPUT_PATH/index.html
- name: copy index.html to 404.html - name: copy index.html to 404.html
run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html

View File

@@ -1,28 +1,50 @@
name: Pack Nuget name: Pack to NuGet
on: on:
push: workflow_dispatch:
branches: [ "action/pack" ] inputs:
pull_request: Ursa:
branches: [ "action/pack" ] description: 'Pack Ursa'
required: true
default: 'true'
type: boolean
Ursa_Themes_Semi:
description: 'Pack Ursa.Themes.Semi'
required: true
default: 'true'
type: boolean
PrismExtension:
description: 'Pack Prism Extension'
required: true
default: 'false'
type: boolean
ReactiveUIExtension:
description: 'Pack ReactiveUI Extension'
required: true
default: 'false'
type: boolean
jobs: jobs:
nuget: Pack_to_NuGet:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.1
- name: Nuget Ursa - name: Pack Ursa
if: ${{ github.event.inputs.Ursa == 'true' }}
run: dotnet pack ./src/Ursa -o ./nugets run: dotnet pack ./src/Ursa -o ./nugets
- name: Nuget Ursa.Themes.Semi - name: Pack Ursa.Themes.Semi
if: ${{ github.event.inputs.Ursa_Themes_Semi == 'true' }}
run: dotnet pack ./src/Ursa.Themes.Semi -o ./nugets run: dotnet pack ./src/Ursa.Themes.Semi -o ./nugets
- name: Nuget Prism Extension - name: Pack Prism Extension
if: ${{ github.event.inputs.PrismExtension == 'true' }}
run: dotnet pack ./src/Ursa.PrismExtension -o ./nugets run: dotnet pack ./src/Ursa.PrismExtension -o ./nugets
- name: Nuget ReactiveUI Extension - name: Pack ReactiveUI Extension
if: ${{ github.event.inputs.ReactiveUIExtension == 'true' }}
run: dotnet pack ./src/Ursa.ReactiveUIExtension -o ./nugets run: dotnet pack ./src/Ursa.ReactiveUIExtension -o ./nugets
- name: Publish NuGet package - name: Publish NuGet package
@@ -33,3 +55,4 @@ jobs:
with: with:
name: nugets name: nugets
path: ./nugets path: ./nugets
if: always()

View File

@@ -1,13 +1,27 @@
name: Publish Demo name: Publish Demo
on: on:
push: workflow_dispatch:
branches: [ "action/publish" ] inputs:
pull_request: platform:
branches: [ "action/publish" ] description: 'Platform to publish'
required: true
default: 'all'
type: choice
options:
- 'windows'
- 'linux'
- 'android'
- 'all'
include_aot:
description: 'Include Windows AOT packaging'
required: true
default: true
type: boolean
jobs: jobs:
windows: windows:
if: ${{ github.event.inputs.platform == 'windows' || github.event.inputs.platform == 'all' }}
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout - name: Checkout
@@ -25,14 +39,17 @@ jobs:
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.zip Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.zip
- name: Enable Native AOT in .csproj - name: Enable Native AOT in .csproj
if: ${{ github.event.inputs.include_aot == true }}
run: | run: |
sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj sed -i 's#<!--<PublishAot>true</PublishAot>-->#<PublishAot>true</PublishAot>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj sed -i 's#<!--<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>-->#<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
- name: Publish win-x64 AOT - name: Publish win-x64 AOT
if: ${{ github.event.inputs.include_aot == true }}
run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot
- name: Zip win-x64 AOT - name: Zip win-x64 AOT
if: ${{ github.event.inputs.include_aot == true }}
run: | run: |
$files = Get-ChildItem -Path ./publish/win64-aot/* -Recurse -Exclude *.pdb $files = Get-ChildItem -Path ./publish/win64-aot/* -Recurse -Exclude *.pdb
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.NativeAOT.zip Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.NativeAOT.zip
@@ -44,6 +61,7 @@ jobs:
path: ./upload path: ./upload
linux: linux:
if: ${{ github.event.inputs.platform == 'linux' || github.event.inputs.platform == 'all' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@@ -65,6 +83,7 @@ jobs:
path: ./upload path: ./upload
android: android:
if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'all' }}
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout - name: Checkout