From 58e1ef5b66e27bf0c2ee1bd75b07258c397068b7 Mon Sep 17 00:00:00 2001
From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
Date: Sat, 28 Dec 2024 20:05:27 +0800
Subject: [PATCH 1/4] feat: manually managing pack, publish & deploy workflows.
---
.github/workflows/deploy.yml | 7 ++----
.github/workflows/pack.yml | 47 ++++++++++++++++++++++++++---------
.github/workflows/publish.yml | 27 +++++++++++++++++---
3 files changed, 60 insertions(+), 21 deletions(-)
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 1973f6e..6fc71ac 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -4,10 +4,7 @@ env:
PROJECT_PATH: demo/Ursa.Demo.Browser/Ursa.Demo.Browser.csproj
OUTPUT_PATH: demo/Ursa.Demo.Browser/bin/Release/net8.0-browser/publish/wwwroot
on:
- push:
- branches: [ "action/deploy" ]
- pull_request:
- branches: [ "action/deploy" ]
+ workflow_dispatch:
jobs:
deploy-to-github-pages:
@@ -28,7 +25,7 @@ jobs:
run: dotnet publish $PROJECT_PATH -c Release --nologo
- name: Change base-tag in index.html
- run: sed -i 's///g' $OUTPUT_PATH/index.html
+ run: sed -i 's###g' $OUTPUT_PATH/index.html
- name: copy index.html to 404.html
run: cp $OUTPUT_PATH/index.html $OUTPUT_PATH/404.html
diff --git a/.github/workflows/pack.yml b/.github/workflows/pack.yml
index 98ca915..1a5ab9f 100644
--- a/.github/workflows/pack.yml
+++ b/.github/workflows/pack.yml
@@ -1,28 +1,50 @@
-name: Pack Nuget
+name: Pack to NuGet
on:
- push:
- branches: [ "action/pack" ]
- pull_request:
- branches: [ "action/pack" ]
+ workflow_dispatch:
+ inputs:
+ Ursa:
+ 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:
- nuget:
+ Pack_to_NuGet:
runs-on: ubuntu-latest
steps:
- name: Checkout
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
- - 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
-
- - name: Nuget Prism Extension
+
+ - name: Pack Prism Extension
+ if: ${{ github.event.inputs.PrismExtension == 'true' }}
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
- name: Publish NuGet package
@@ -33,3 +55,4 @@ jobs:
with:
name: nugets
path: ./nugets
+ if: always()
\ No newline at end of file
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 72221db..9d8d097 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,13 +1,27 @@
name: Publish Demo
on:
- push:
- branches: [ "action/publish" ]
- pull_request:
- branches: [ "action/publish" ]
+ workflow_dispatch:
+ inputs:
+ platform:
+ 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:
windows:
+ if: ${{ github.event.inputs.platform == 'windows' || github.event.inputs.platform == 'all' }}
runs-on: windows-latest
steps:
- name: Checkout
@@ -25,14 +39,17 @@ jobs:
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.zip
- name: Enable Native AOT in .csproj
+ if: ${{ github.event.inputs.include_aot == true }}
run: |
sed -i 's##true#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
sed -i 's##true#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
- 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
- name: Zip win-x64 AOT
+ if: ${{ github.event.inputs.include_aot == true }}
run: |
$files = Get-ChildItem -Path ./publish/win64-aot/* -Recurse -Exclude *.pdb
Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.NativeAOT.zip
@@ -44,6 +61,7 @@ jobs:
path: ./upload
linux:
+ if: ${{ github.event.inputs.platform == 'linux' || github.event.inputs.platform == 'all' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -65,6 +83,7 @@ jobs:
path: ./upload
android:
+ if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'all' }}
runs-on: windows-latest
steps:
- name: Checkout
From df41ffafdbb5bd6e64e469f948fa4b3de1879565 Mon Sep 17 00:00:00 2001
From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
Date: Sat, 28 Dec 2024 20:11:07 +0800
Subject: [PATCH 2/4] feat: add pack-nightly & release-tag workflow.
---
.github/workflows/pack-nightly.yml | 73 +++++++++++++++
.github/workflows/release-tag.yml | 140 +++++++++++++++++++++++++++++
2 files changed, 213 insertions(+)
create mode 100644 .github/workflows/pack-nightly.yml
create mode 100644 .github/workflows/release-tag.yml
diff --git a/.github/workflows/pack-nightly.yml b/.github/workflows/pack-nightly.yml
new file mode 100644
index 0000000..680b6d6
--- /dev/null
+++ b/.github/workflows/pack-nightly.yml
@@ -0,0 +1,73 @@
+name: Pack Nightly
+
+on:
+ workflow_dispatch:
+ inputs:
+ Version_Prefix:
+ description: 'Version Prefix'
+ required: true
+ default: '1.6.999'
+ type: string
+ Ursa:
+ 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:
+ Pack_Nightly:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4.1.1
+
+ - name: Get Version
+ run: |
+ VERSION_TIMESTAMP=$(date +'%Y%m%d%H%M%S')
+ VERSION="${{ github.event.inputs.Version_Prefix }}-nightly-${VERSION_TIMESTAMP}"
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
+
+ - name: Pack Ursa
+ if: ${{ github.event.inputs.Ursa == 'true' }}
+ run: dotnet pack ./src/Ursa -o ./nugets /p:Version=${{ env.VERSION }}
+
+ - name: Pack Ursa.Themes.Semi
+ if: ${{ github.event.inputs.Ursa_Themes_Semi == 'true' }}
+ run: dotnet pack ./src/Ursa.Themes.Semi -o ./nugets /p:Version=${{ env.VERSION }}
+
+ - name: Pack Prism Extension
+ if: ${{ github.event.inputs.PrismExtension == 'true' }}
+ run: dotnet pack ./src/Ursa.PrismExtension -o ./nugets /p:Version=${{ env.VERSION }}
+
+ - name: Pack ReactiveUI Extension
+ if: ${{ github.event.inputs.ReactiveUIExtension == 'true' }}
+ run: dotnet pack ./src/Ursa.ReactiveUIExtension -o ./nugets /p:Version=${{ env.VERSION }}
+
+ - name: Add NuGet Source
+ run: dotnet nuget add source ${{ secrets.IRIHI_NUGET_FEED }} -n irihi.tech -u ${{ secrets.IRIHI_NUGET_USERNAME }} -p ${{ secrets.IRIHI_NUGET_PASSWORD }} --store-password-in-clear-text
+
+ - name: Publish Nightly Package
+ run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.IRIHI_NUGET_API_KEY }} --source irihi.tech --skip-duplicate
+
+ - name: Upload a Build Artifact
+ uses: actions/upload-artifact@v4.3.1
+ with:
+ name: nugets
+ path: ./nugets
+ if: always()
\ No newline at end of file
diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml
new file mode 100644
index 0000000..0a3f345
--- /dev/null
+++ b/.github/workflows/release-tag.yml
@@ -0,0 +1,140 @@
+name: Release Tag
+
+on:
+ push:
+ tags:
+ - "v[0-9]+.[0-9]+.[0-9]+"
+ workflow_dispatch:
+
+jobs:
+ pack:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Pack Ursa
+ run: dotnet pack ./src/Ursa -o ./nugets
+
+ - name: Pack Ursa.Themes.Semi
+ run: dotnet pack ./src/Ursa.Themes.Semi -o ./nugets
+
+ - name: Upload a Build Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: nugets
+ path: ./nugets
+
+ publish-windows:
+ runs-on: windows-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Make upload directory
+ run: mkdir upload
+
+ - name: Publish win-x64
+ run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/win64
+
+ - name: Zip win-x64
+ run: |
+ $files = Get-ChildItem -Path ./publish/win64/* -Recurse -Exclude *.pdb
+ Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.zip
+
+ - name: Enable Native AOT in .csproj
+ run: |
+ sed -i 's##true#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
+ sed -i 's##true#' demo/Ursa.Demo.Desktop/Ursa.Demo.Desktop.csproj
+
+ - name: Publish win-x64 AOT
+ run: dotnet publish demo/Ursa.Demo.Desktop -r win-x64 -c Release -o ./publish/win64-aot
+
+ - name: Zip win-x64 AOT
+ run: |
+ $files = Get-ChildItem -Path ./publish/win64-aot/* -Recurse -Exclude *.pdb
+ Compress-Archive -Path $files.FullName -DestinationPath ./upload/Ursa.Demo.Desktop.win-x64.NativeAOT.zip
+
+ - name: Upload a Build Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: windows
+ path: ./upload
+
+ publish-linux:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Make upload directory
+ run: mkdir upload
+
+ - name: Publish linux-x64
+ run: dotnet publish demo/Ursa.Demo.Desktop -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/linux64
+
+ - name: Zip linux-x64
+ run: zip -j -r ./upload/Ursa.Demo.Desktop.linux-x64.zip ./publish/linux64 -x "*.pdb"
+
+ - name: Upload a Build Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: linux
+ path: ./upload
+
+ publish-android:
+ runs-on: windows-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: CD Android
+ run: cd ./demo/Ursa.Demo.Android
+
+ - name: Restore Dependencies
+ run: dotnet restore
+
+ - name: Publish Android
+ run: dotnet publish demo/Ursa.Demo.Android -c Release -f net8.0-android --no-restore -o ./publish -p:RuntimeIdentifier=android-arm64
+
+ - name: Upload a Build Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: android
+ path: ./publish/*Signed.apk
+
+ draft-release:
+ needs: [ pack, publish-windows, publish-linux, publish-android ]
+ runs-on: ubuntu-latest
+ steps:
+ - name: Download nugets Artifacts
+ uses: actions/download-artifact@v4
+ with:
+ name: nugets
+
+ - name: Download windows Artifacts
+ uses: actions/download-artifact@v4
+ with:
+ name: windows
+
+ - name: Download linux Artifacts
+ uses: actions/download-artifact@v4
+ with:
+ name: linux
+
+ - name: Download android Artifacts
+ uses: actions/download-artifact@v4
+ with:
+ name: android
+
+ - name: Release
+ uses: softprops/action-gh-release@v2
+ if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
+ with:
+ generate_release_notes: true
+ draft: true
+ files: |
+ *.nupkg
+ *.zip
+ *.apk
From b49e1aa583c0ac1fecadb6a3b11e274890c38e67 Mon Sep 17 00:00:00 2001
From: Zhang Dian <54255897+zdpcdt@users.noreply.github.com>
Date: Sat, 28 Dec 2024 20:14:30 +0800
Subject: [PATCH 3/4] misc: add workflow_dispatch to test workflow.
---
.github/workflows/test.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 2d9e8a0..a83b971 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -5,6 +5,7 @@ on:
branches: [ "main", "action/publish" ]
pull_request:
branches: [ "main" ]
+ workflow_dispatch:
jobs:
windows:
From df6db4a400872b50c28229b60223970c6039b6b3 Mon Sep 17 00:00:00 2001
From: rabbitism
Date: Mon, 30 Dec 2024 13:47:57 +0800
Subject: [PATCH 4/4] feat: update nightly feed.
---
.github/workflows/pack-nightly.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/pack-nightly.yml b/.github/workflows/pack-nightly.yml
index 680b6d6..bd21ba8 100644
--- a/.github/workflows/pack-nightly.yml
+++ b/.github/workflows/pack-nightly.yml
@@ -60,7 +60,7 @@ jobs:
run: dotnet pack ./src/Ursa.ReactiveUIExtension -o ./nugets /p:Version=${{ env.VERSION }}
- name: Add NuGet Source
- run: dotnet nuget add source ${{ secrets.IRIHI_NUGET_FEED }} -n irihi.tech -u ${{ secrets.IRIHI_NUGET_USERNAME }} -p ${{ secrets.IRIHI_NUGET_PASSWORD }} --store-password-in-clear-text
+ run: dotnet nuget add source ${{ secrets.IRIHI_NUGET_NIGHTLY_FEED }} -n irihi.tech -u ${{ secrets.IRIHI_NUGET_USERNAME }} -p ${{ secrets.IRIHI_NUGET_PASSWORD }} --store-password-in-clear-text
- name: Publish Nightly Package
run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.IRIHI_NUGET_API_KEY }} --source irihi.tech --skip-duplicate