1- name : Build Windows
2- on : [push, pull_request]
3- env :
4- DOTNET_CLI_TELEMETRY_OPTOUT : 1
1+ name : Build
2+ on :
3+ push :
4+ branches :
5+ - master
6+ paths :
7+ - ' !**/*.md'
8+ workflow_dispatch :
9+ inputs :
10+ publish-github-package :
11+ type : boolean
12+ description : ' Github Package push'
13+ default : true
14+ required : false
15+ publish-myget-package :
16+ type : boolean
17+ description : ' MyGet Package push'
18+ default : true
19+ required : false
20+
521jobs :
6- build :
22+ build-test-pack :
723 runs-on : windows-latest
824 steps :
925 - name : Checkout
1329 - name : Setup .NET Core
1430 uses : actions/setup-dotnet@v4
1531 with :
16- dotnet-version : |
17- 6.x
18- 8.x
32+ dotnet-version : 9.x
1933
2034 - name : Build Reason
2135 run : " echo ref: ${{github.ref}} event: ${{github.event_name}}"
@@ -59,32 +73,40 @@ jobs:
5973 done
6074
6175 - name : Package
76+ if : ${{ inputs.publish-github-package || inputs.publish-myget-package}}
6277 shell : bash
63- if : github.event_name != 'pull_request'
6478 run : |
6579 for project in $(find ./src -name "*.csproj"); do
6680 dotnet pack --configuration Release --no-build $project -p:PackageVersion=${{ env.FULL_VERSION }} -p:SymbolPackageFormat=snupkg --include-source --output ./artifacts/packages
6781 done
6882
6983 - name : Install GitHub Package Tool
70- if : github.event_name != 'pull_request'
84+ if : ${{ inputs.publish-github-package}}
7185 run : dotnet tool install gpr -g
7286
7387 - name : Publish CI Packages
88+ if : ${{ inputs.publish-github-package || inputs.publish-myget-package}}
7489 shell : bash
75- if : github.event_name != 'pull_request'
7690 run : |
7791 for package in $(find ./artifacts/packages/ -name "*.nupkg" -o -name "*.snupkg"); do
7892 echo "$package": Pushing $package...
7993
80- # GitHub
81- echo "Pushing to GitHub Package Registry..."
82- gpr push "$package" -k ${{ secrets.GITHUB_TOKEN }} || echo "Skipping: Package push failed or already exists."
83-
84- # myget
85- echo "Pushing to MyGet..."
86- dotnet nuget push "$package" \
87- --source "https://www.myget.org/F/aspectcore/api/v2/package" \
88- --api-key ${{ secrets.MYGET_API_TOKEN }} \
89- --skip-duplicate || echo "Skipping: Package push failed or already exists."
94+ if [ "${{ inputs.publish-github-package }}" = "true" ]; then
95+ # GitHub
96+ echo "Pushing to GitHub Package Registry..."
97+ gpr push "$package" -k ${{ secrets.GITHUB_TOKEN }} || echo "Skipping: Package push failed or already exists."
98+ else
99+ echo "Skipping: Pushing to GitHub Package Registry is disabled."
100+ fi
101+
102+ # MyGet
103+ if [ "${{ inputs.publish-myget-package }}" = "true" ]; then
104+ echo "Pushing to MyGet..."
105+ dotnet nuget push "$package" \
106+ --source "https://www.myget.org/F/aspectcore/api/v2/package" \
107+ --api-key ${{ secrets.MYGET_API_TOKEN }} \
108+ --skip-duplicate || echo "Skipping: Package push failed or already exists."
109+ else
110+ echo "Skipping: Pushing to MyGet Package Registry is disabled."
111+ fi
90112 done
0 commit comments