diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 16165d3..a1703f8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,10 +4,7 @@ env: PROJECT_PATH: demo/Semi.Avalonia.Demo.Web/Semi.Avalonia.Demo.Web.csproj OUTPUT_PATH: demo/Semi.Avalonia.Demo.Web/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-nightly.yml b/.github/workflows/pack-nightly.yml new file mode 100644 index 0000000..f657602 --- /dev/null +++ b/.github/workflows/pack-nightly.yml @@ -0,0 +1,68 @@ +name: Pack Nightly + +on: + workflow_dispatch: + inputs: + Semi_Avalonia: + description: 'Pack Semi.Avalonia' + required: true + default: 'true' + type: boolean + Semi_Avalonia_ColorPicker: + description: 'Pack Semi.Avalonia.ColorPicker' + required: true + default: 'true' + type: boolean + Semi_Avalonia_DataGrid: + description: 'Pack Semi.Avalonia.DataGrid' + required: true + default: 'true' + type: boolean + Semi_Avalonia_TreeDataGrid: + description: 'Pack Semi.Avalonia.TreeDataGrid' + 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="${{ vars.VERSION_NIGHTLY_PREFIX }}-nightly-${VERSION_TIMESTAMP}" + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Pack Semi.Avalonia + if: ${{ github.event.inputs.Semi_Avalonia == 'true' }} + run: dotnet pack ./src/Semi.Avalonia -o ./nugets /p:Version=${{ env.VERSION }} + + - name: Pack Semi.Avalonia.ColorPicker + if: ${{ github.event.inputs.Semi_Avalonia_ColorPicker == 'true' }} + run: dotnet pack ./src/Semi.Avalonia.ColorPicker -o ./nugets /p:Version=${{ env.VERSION }} + + - name: Pack Semi.Avalonia.DataGrid + if: ${{ github.event.inputs.Semi_Avalonia_DataGrid == 'true' }} + run: dotnet pack ./src/Semi.Avalonia.DataGrid -o ./nugets /p:Version=${{ env.VERSION }} + + - name: Pack Semi.Avalonia.TreeDataGrid + if: ${{ github.event.inputs.Semi_Avalonia_TreeDataGrid == 'true' }} + run: dotnet pack ./src/Semi.Avalonia.TreeDataGrid -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/pack-tree.yml b/.github/workflows/pack-tree.yml deleted file mode 100644 index 1d2a6cd..0000000 --- a/.github/workflows/pack-tree.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Pack TreeDataGrid Nuget - -on: - push: - branches: [ "action/pack-tree" ] - pull_request: - branches: [ "action/pack-tree" ] - -jobs: - nuget: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - - - name: Nuget Semi.Avalonia.TreeDataGrid - run: dotnet pack ./src/Semi.Avalonia.TreeDataGrid -o ./nugets - - - name: Publish NuGet package - run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate - - - name: Upload a Build Artifact - uses: actions/upload-artifact@v4.3.1 - with: - name: nugets - path: ./nugets diff --git a/.github/workflows/pack.yml b/.github/workflows/pack.yml index e27e35a..a9fe7c5 100644 --- a/.github/workflows/pack.yml +++ b/.github/workflows/pack.yml @@ -1,26 +1,52 @@ -name: Pack Nuget +name: Pack to NuGet on: - push: - branches: [ "action/pack" ] - pull_request: - branches: [ "action/pack" ] + workflow_dispatch: + inputs: + Semi_Avalonia: + description: 'Pack Semi.Avalonia' + required: true + default: 'true' + type: boolean + Semi_Avalonia_ColorPicker: + description: 'Pack Semi.Avalonia.ColorPicker' + required: true + default: 'true' + type: boolean + Semi_Avalonia_DataGrid: + description: 'Pack Semi.Avalonia.DataGrid' + required: true + default: 'true' + type: boolean + Semi_Avalonia_TreeDataGrid: + description: 'Pack Semi.Avalonia.TreeDataGrid' + 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 Semi.Avalonia + - name: Pack Semi.Avalonia + if: ${{ github.event.inputs.Semi_Avalonia == 'true' }} run: dotnet pack ./src/Semi.Avalonia -o ./nugets - - name: Nuget Semi.Avalonia.ColorPicker - run: dotnet pack ./src/Semi.Avalonia.ColorPicker -o ./nugets + - name: Pack Semi.Avalonia.ColorPicker + if: ${{ github.event.inputs.Semi_Avalonia_ColorPicker == 'true' }} + run: dotnet pack ./src/Semi.Avalonia.ColorPicker -o ./nugets - - name: Nuget Semi.Avalonia.DataGrid - run: dotnet pack ./src/Semi.Avalonia.DataGrid -o ./nugets + - name: Pack Semi.Avalonia.DataGrid + if: ${{ github.event.inputs.Semi_Avalonia_DataGrid == 'true' }} + run: dotnet pack ./src/Semi.Avalonia.DataGrid -o ./nugets + + - name: Pack Semi.Avalonia.TreeDataGrid + if: ${{ github.event.inputs.Semi_Avalonia_TreeDataGrid == 'true' }} + run: dotnet pack ./src/Semi.Avalonia.TreeDataGrid -o ./nugets - name: Publish NuGet package run: dotnet nuget push "./nugets/*.nupkg" --api-key ${{ secrets.NUGET_ORG_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate @@ -30,3 +56,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 21f7fc8..f736ef2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,13 +1,32 @@ 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 + include_drm: + description: 'Include Linux DRM 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 +44,17 @@ jobs: Compress-Archive -Path $files.FullName -DestinationPath ./upload/Semi.Avalonia.Demo.Desktop.win-x64.zip - name: Enable Native AOT in .csproj + if: ${{ github.event.inputs.include_aot == true }} run: | sed -i 's##true#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj sed -i 's##true#' demo/Semi.Avalonia.Demo.Desktop/Semi.Avalonia.Demo.Desktop.csproj - name: Publish win-x64 AOT + if: ${{ github.event.inputs.include_aot == true }} run: dotnet publish demo/Semi.Avalonia.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/Semi.Avalonia.Demo.Desktop.win-x64.NativeAOT.zip @@ -44,6 +66,7 @@ jobs: path: ./upload linux: + if: ${{ github.event.inputs.platform == 'linux' || github.event.inputs.platform == 'all' }} runs-on: ubuntu-latest steps: - name: Checkout @@ -59,9 +82,11 @@ jobs: run: zip -j -r ./upload/Semi.Avalonia.Demo.Desktop.linux-x64.zip ./publish/linux64 -x "*.pdb" - name: Publish linux-x64 DRM + if: ${{ github.event.inputs.include_drm == true }} run: dotnet publish demo/Semi.Avalonia.Demo.Drm -r linux-x64 -c Release --sc /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o ./publish/drm - name: Zip linux-x64 DRM + if: ${{ github.event.inputs.include_drm == true }} run: zip -j -r ./upload/Semi.Avalonia.Demo.Drm.linux-x64.zip ./publish/drm -x "*.pdb" - name: Upload a Build Artifact @@ -71,6 +96,7 @@ jobs: path: ./upload android: + if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'all' }} runs-on: windows-latest steps: - name: Checkout diff --git a/Semi.Avalonia.sln b/Semi.Avalonia.sln index b7564d0..210c5d4 100644 --- a/Semi.Avalonia.sln +++ b/Semi.Avalonia.sln @@ -16,7 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHub Action", "GitHub Act ProjectSection(SolutionItems) = preProject .github\workflows\deploy.yml = .github\workflows\deploy.yml .github\workflows\pack.yml = .github\workflows\pack.yml - .github\workflows\pack-tree.yml = .github\workflows\pack-tree.yml + .github\workflows\pack-nightly.yml = .github\workflows\pack-nightly.yml .github\workflows\publish.yml = .github\workflows\publish.yml EndProjectSection EndProject