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
+
5
21
jobs :
6
- build :
22
+ build-test-pack :
7
23
runs-on : windows-latest
8
24
steps :
9
25
- name : Checkout
13
29
- name : Setup .NET Core
14
30
uses : actions/setup-dotnet@v4
15
31
with :
16
- dotnet-version : |
17
- 6.x
18
- 8.x
32
+ dotnet-version : 9.x
19
33
20
34
- name : Build Reason
21
35
run : " echo ref: ${{github.ref}} event: ${{github.event_name}}"
@@ -59,32 +73,40 @@ jobs:
59
73
done
60
74
61
75
- name : Package
76
+ if : ${{ inputs.publish-github-package || inputs.publish-myget-package}}
62
77
shell : bash
63
- if : github.event_name != 'pull_request'
64
78
run : |
65
79
for project in $(find ./src -name "*.csproj"); do
66
80
dotnet pack --configuration Release --no-build $project -p:PackageVersion=${{ env.FULL_VERSION }} -p:SymbolPackageFormat=snupkg --include-source --output ./artifacts/packages
67
81
done
68
82
69
83
- name : Install GitHub Package Tool
70
- if : github.event_name != 'pull_request'
84
+ if : ${{ inputs.publish-github-package}}
71
85
run : dotnet tool install gpr -g
72
86
73
87
- name : Publish CI Packages
88
+ if : ${{ inputs.publish-github-package || inputs.publish-myget-package}}
74
89
shell : bash
75
- if : github.event_name != 'pull_request'
76
90
run : |
77
91
for package in $(find ./artifacts/packages/ -name "*.nupkg" -o -name "*.snupkg"); do
78
92
echo "$package": Pushing $package...
79
93
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
90
112
done
0 commit comments