-
Notifications
You must be signed in to change notification settings - Fork 1
153 lines (118 loc) · 5.62 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: .NET
on: [push]
jobs:
linux:
strategy:
matrix:
netver: [6.0, 7.0, 8.0]
runs-on: ubuntu-latest
steps:
#-----------------------------------------------------------------------
# Checkout
- uses: actions/checkout@v3
with:
fetch-depth: 0
# lfs: true
#- name: Checkout LFS objects
# run: git lfs checkout
- name: Extract branch name
id: extract_branch_name
run: |
export branch_name=`git name-rev --name-only --exclude=tags/* HEAD`
echo "Detected current branch: ${branch_name}"
echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT
#-----------------------------------------------------------------------
# Setup environments
- name: Uninstall Existing .NET SDK
run: |
sudo apt-get remove --purge '^dotnet-sdk-' -y
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
${{ matrix.netver }}.x
- name: Setup NuGet package reference
run: |
# dotnet nuget add source ${{secrets.GH_LOCAL_NUGET_URL}} -n ref1 -u ${{secrets.GH_LOCAL_NUGET_USER}} -p ${{secrets.GH_LOCAL_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config
# dotnet nuget add source ${{secrets.GH_NUGET_URL}} -n ref2 -u ${{secrets.GH_NUGET_USER}} -p ${{secrets.GH_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config
#-----------------------------------------------------------------------
# Build
- name: Build
run: dotnet build -p:Configuration=Release -p:Platform="Any CPU" -p:RestoreNoCache=True -p:BuildIdentifier=${GITHUB_RUN_NUMBER} ILRepack.FullAuto.sln
- name: Build NuGet packages
run: dotnet pack -p:Configuration=Release -p:Platform="Any CPU" -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -o artifacts ILRepack.FullAuto.sln
#-----------------------------------------------------------------------
# Test
# - name: Test
# run: dotnet test --no-restore --verbosity normal -p:CITest=True
# timeout-minutes: 2
#-----------------------------------------------------------------------
# Deploy packages (develop)
#- name: Deploy NuGet package (develop/ref1)
# if: startsWith( github.ref, 'refs/tags/' )
# run: dotnet nuget push artifacts/ILRepack.FullAuto.*.nupkg --source ref1
#-----------------------------------------------------------------------
# Deploy packages (main)
#- name: Deploy NuGet package (main/ref2)
# if: (startsWith( github.ref, 'refs/tags/' )) && (endsWith(steps.extract_branch_name.outputs.branch_name, 'main'))
# run: dotnet nuget push artifacts/ILRepack.FullAuto.*.nupkg --source ref1
windows:
strategy:
matrix:
netver: [6.0, 7.0, 8.0]
runs-on: windows-latest
steps:
#-----------------------------------------------------------------------
# Checkout
- uses: actions/checkout@v3
with:
fetch-depth: 0
# lfs: true
#- name: Checkout LFS objects
# run: git lfs checkout
- name: Extract branch name
id: extract_branch_name
run: |
$branch_name=$(git name-rev --name-only --exclude=tags/* HEAD)
echo "Detected current branch: ${branch_name}"
echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT
#-----------------------------------------------------------------------
# Setup environments
# windows vm is not clean, but I don't know how to make clean environment...
#- name: Uninstall Existing .NET SDK
# run: |
# $sdkVersions = Get-Command -Name dotnet | ForEach-Object { $_.FileVersionInfo.ProductVersion }
# foreach ($sdkVersion in $sdkVersions) {
# Write-Host "Uninstalling .NET SDK version: $sdkVersion"
# dotnet sdk uninstall -v $sdkVersion --all
# }
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
${{ matrix.netver }}.x
- name: Setup NuGet package reference
run: |
# dotnet nuget add source ${{secrets.GH_LOCAL_NUGET_URL}} -n ref1 -u ${{secrets.GH_LOCAL_NUGET_USER}} -p ${{secrets.GH_LOCAL_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config
# dotnet nuget add source ${{secrets.GH_NUGET_URL}} -n ref2 -u ${{secrets.GH_NUGET_USER}} -p ${{secrets.GH_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config
#-----------------------------------------------------------------------
# Build
- name: Build
run: dotnet build -p:Configuration=Release -p:Platform="Any CPU" -p:RestoreNoCache=True -p:BuildIdentifier=${GITHUB_RUN_NUMBER} ILRepack.FullAuto.sln
- name: Build NuGet packages
run: dotnet pack -p:Configuration=Release -p:Platform="Any CPU" -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -o artifacts ILRepack.FullAuto.sln
#-----------------------------------------------------------------------
# Test
# - name: Test
# run: dotnet test --no-restore --verbosity normal -p:CITest=True
# timeout-minutes: 2
#-----------------------------------------------------------------------
# Deploy packages (develop)
#- name: Deploy NuGet package (develop/ref1)
# if: startsWith( github.ref, 'refs/tags/' )
# run: dotnet nuget push artifacts/ILRepack.FullAuto.*.nupkg --source ref1
#-----------------------------------------------------------------------
# Deploy packages (main)
#- name: Deploy NuGet package (main/ref2)
# if: (startsWith( github.ref, 'refs/tags/' )) && (endsWith(steps.extract_branch_name.outputs.branch_name, 'main'))
# run: dotnet nuget push artifacts\ILRepack.FullAuto.*.nupkg --source ref1