-
-
Notifications
You must be signed in to change notification settings - Fork 36
151 lines (128 loc) · 5.07 KB
/
windows.yml
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
name: Windows Build
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DOTNET_INSTALL_DIR: ${{ github.workspace }}/.dotnet
DOTNET_VERSION: '8.0.x'
IS_PRE_RELEASE: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' || contains(github.event.head_commit.message, '[prerelease]') }}
jobs:
BuildNugetPackages-Windows:
strategy:
matrix:
os: [self-hosted-win-x64]
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
defaults:
run:
working-directory: win
steps:
- uses: actions/checkout@v3.0.0
with:
fetch-depth: 0
- name: Restore cached packages
id: build-packages-cache-restore
uses: maxnowack/local-cache@main
with:
path: |
${{ github.workspace }}/build-win
${{ github.workspace }}/.dotnet
key: ${{ runner.os }}-packages
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Compile GDAL and create packages
id: compile-source
run: |
./install.ps1 -buildNumberTail ${{ github.run_number }} -preRelease $${{ env.IS_PRE_RELEASE }}
echo "GDAL_VERSION=$env:GDAL_VERSION" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Store metadata as artifact
uses: actions/upload-artifact@v4
with:
name: metadata-win-x64
path: shared/bundle/targets/
overwrite: true
- name: Store packages as artifact
uses: actions/upload-artifact@v4
with:
name: packages-win-x64
path: nuget/*.nupkg
overwrite: true
outputs:
gdal-version: ${{ steps.compile-source.outputs.GDAL_VERSION }}
TestPackages-Windows:
strategy:
matrix:
os: [self-hosted-win-x64]
needs: BuildNugetPackages-Windows
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
defaults:
run:
working-directory: win
env:
GDAL_VERSION: ${{ needs.BuildNugetPackages-Windows.outputs.gdal-version }}
steps:
- uses: actions/checkout@v3.0.0
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: packages-win-x64
path: nuget/
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: NuGet - Update credentials
run: |
dotnet nuget update source github --store-password-in-clear-text -u ${{ secrets.API_USER_GITHUB }} -p ${{ secrets.API_KEY_GITHUB }} --configfile ../nuget.config
dotnet nuget update source nuget.org --store-password-in-clear-text -u ${{ secrets.API_USER_NUGET }} -p ${{ secrets.API_KEY_NUGET }} --configfile ../nuget.config
dotnet nuget remove source local 1>$null
dotnet nuget remove source local.ci 1>$null
dotnet nuget add source "${{ github.workspace}}/nuget/" --name local.ci
shell: pwsh
- name: Test packages
run: ./test.ps1 -buildNumberTail ${{ github.run_number }} -preRelease $${{ env.IS_PRE_RELEASE }}
shell: pwsh
PushPackages-Windows:
needs: TestPackages-Windows
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
defaults:
run:
working-directory: unix
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Download artifact
uses: actions/download-artifact@v4
with:
pattern: packages-win*
merge-multiple: true
path: nuget/
- run: ls -la ../nuget/
- name: NuGet - Update credentials
run: |
dotnet nuget update source github --store-password-in-clear-text -u ${{ secrets.API_USER_GITHUB }} -p ${{ secrets.API_KEY_GITHUB }}
dotnet nuget update source nuget.org --store-password-in-clear-text -u ${{ secrets.API_USER_NUGET }} -p ${{ secrets.API_KEY_NUGET }}
dotnet nuget remove source local || true
dotnet nuget remove source local.ci || true
dotnet nuget add source "${{ github.workspace}}/nuget/" --name local.ci --configfile ${{ github.workspace}}/nuget.config
- name: Push packages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
make -f push-packages-makefile BUILD_NUMBER_TAIL=${{ github.run_number }} API_KEY_GITHUB=${{ secrets.API_KEY_GITHUB }} API_KEY_NUGET=${{ secrets.API_KEY_NUGET }}