1
1
name : build-and-deploy
2
- run-name : Build${{ inputs.build_only == '' && ' and deploy' || '' }} ${{ inputs.package }}
2
+ run-name : Build${{ inputs.build_only == '' && ' and deploy' || '' }} ${{ !startsWith( inputs.package, 'mingw-w64-') && inputs.repo != 'MSYS2-packages' && inputs.package != 'git-extra' && inputs.package != 'git-for-windows-keyring' && 'mingw-w64-' || '' }}${{ inputs.package }}${{ inputs.architecture && ' (${{ inputs.architecture }})' || '' }}
3
3
4
4
on :
5
5
workflow_dispatch :
16
16
ref :
17
17
description : ' The ref containing the package definition'
18
18
required : true
19
+ architecture :
20
+ description : ' The architecture to build for (only for MSYS packages)'
21
+ required : false
19
22
actor :
20
23
description : The GitHub user on whose behalf this workflow is run
21
24
required : false
26
29
OWNER : " git-for-windows"
27
30
REPO : " ${{ github.event.inputs.repo }}"
28
31
REF : " ${{ github.event.inputs.ref }}"
32
+ ARCHITECTURE : " ${{ github.event.inputs.architecture }}"
29
33
GPG_OPTIONS : " --batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
30
34
HOME : " ${{ github.workspace }}\\ home"
31
35
ACTOR : " ${{ github.event.inputs.actor || github.triggering_actor }}"
36
+ CREATE_CHECK_RUN : true
32
37
33
38
jobs :
34
39
build :
44
49
# Therefore, we registered a GitHub App and stored the data required to
45
50
# act as that App in repository secrets `GH_APP_ID`, `GH_APP_PRIVATE_KEY`.
46
51
- name : Obtain installation token
52
+ if : env.CREATE_CHECK_RUN != 'false'
47
53
id : setup
48
54
uses : actions/github-script@v6
49
55
with :
72
78
core.setOutput('token', accessToken)
73
79
74
80
- name : get check run id
81
+ if : env.CREATE_CHECK_RUN != 'false'
75
82
id : check-run
76
83
uses : actions/github-script@v6
77
84
with :
@@ -114,24 +121,34 @@ jobs:
114
121
git config --global user.name "$USER_NAME" &&
115
122
git config --global user.email "$USER_EMAIL" &&
116
123
echo "PACKAGER=$USER_NAME <$USER_EMAIL>" >>$GITHUB_ENV &&
117
- if test git-extra != "$PACKAGE_TO_BUILD" && test "z${PACKAGE_TO_BUILD#mingw-w64-}" = "z$PACKAGE_TO_BUILD"
124
+ if test MSYS2-packages != "$REPO" &&
125
+ test git-extra != "$PACKAGE_TO_BUILD" &&
126
+ test git-for-windows-keyring != "$PACKAGE_TO_BUILD" &&
127
+ test "z${PACKAGE_TO_BUILD#mingw-w64-}" = "z$PACKAGE_TO_BUILD"
118
128
then
119
129
echo "PACKAGE_TO_BUILD=mingw-w64-$PACKAGE_TO_BUILD" >>$GITHUB_ENV
120
130
fi
121
131
122
132
- name : Download Git for Windows SDK
123
133
uses : git-for-windows/setup-git-for-windows-sdk@v1
124
134
with :
125
- flavor : full
135
+ flavor : ${{ env.PACKAGE_TO_BUILD == 'mingw-w64-git' && 'build-installers' || 'full' }}
136
+ architecture : ${{ env.ARCHITECTURE || 'x86_64' }}
137
+ msys : ${{ env.REPO == 'MSYS2-packages' || env.PACKAGE_TO_BUILD == 'git-for-windows-keyring' }}
126
138
127
- - name : Clone build-extra
139
+ - name : Clone ${{ env.REPO }}
128
140
shell : bash
129
141
run : |
130
142
mkdir -p /usr/src &&
131
- git init -b main /usr/src/build-extra &&
132
- git -C /usr/src/build-extra remote add origin "https://github.com/$OWNER/$REPO" &&
133
- git -C /usr/src/build-extra fetch --depth 1 origin $REF &&
134
- git -C /usr/src/build-extra switch -d FETCH_HEAD
143
+ git init -b main /usr/src/${{ env.REPO }} &&
144
+ git -C /usr/src/${{ env.REPO }} remote add origin "https://github.com/$OWNER/$REPO" &&
145
+ git -C /usr/src/${{ env.REPO }} fetch --depth 1 origin $REF &&
146
+ git -C /usr/src/${{ env.REPO }} reset --hard FETCH_HEAD
147
+
148
+ - name : Clone build-extra (unless cloned already)
149
+ if : env.REPO != 'build-extra'
150
+ shell : bash
151
+ run : git clone --depth 1 --single-branch -b main https://github.com/git-for-windows/build-extra /usr/src/build-extra
135
152
136
153
- name : pacman -Syyu
137
154
shell : bash
@@ -176,19 +193,27 @@ jobs:
176
193
echo "$CODESIGN_P12" | tr % '\n' | base64 -d >home/.sig/codesign.p12 &&
177
194
echo "$CODESIGN_PASS" >home/.sig/codesign.pass
178
195
git config --global alias.signtool '!sh "/usr/src/build-extra/signtool.sh"'
196
+ echo "SIGNTOOL=git signtool" >>$GITHUB_ENV
179
197
180
198
- name : Build ${{env.PACKAGE_TO_BUILD}}
181
199
env :
182
200
GPGKEY : ${{secrets.GPGKEY}}
201
+ MAKEPKG : ${{ env.REPO != 'MSYS2-packages' && env.PACKAGE_TO_BUILD != 'git-for-windows-keyring' && 'makepkg-mingw' || 'makepkg' }}
183
202
shell : bash
184
203
run : |
185
204
dir="$(cygpath -au artifacts)" &&
186
205
mkdir -p "$dir" &&
206
+
207
+ {
208
+ test -f /usr/bin/git ||
209
+ printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git
210
+ } &&
211
+
187
212
cd "/usr/src/$REPO/$PACKAGE_TO_BUILD" &&
188
- MAKEFLAGS=-j6 PKGEXT='.pkg.tar.xz' MINGW_ARCH="mingw32 mingw64" makepkg-mingw -s --noconfirm &&
213
+ MAKEFLAGS=-j6 PKGEXT='.pkg.tar.xz' MINGW_ARCH="mingw32 mingw64" $MAKEPKG -s --noconfirm &&
189
214
cp *.pkg.tar* "$dir/" &&
190
215
191
- MAKEFLAGS=-j6 SRCEXT='.src.tar.gz' MINGW_ARCH=mingw64 makepkg-mingw --allsource &&
216
+ MAKEFLAGS=-j6 SRCEXT='.src.tar.gz' MINGW_ARCH=mingw64 $MAKEPKG --allsource &&
192
217
cp *.src.tar* "$dir/" &&
193
218
194
219
# Ensure that the Git worktree is still clean
@@ -203,6 +228,7 @@ jobs:
203
228
fi
204
229
205
230
- name : update check-run
231
+ if : env.CREATE_CHECK_RUN != 'false'
206
232
uses : actions/github-script@v6
207
233
with :
208
234
script : |
@@ -231,7 +257,7 @@ jobs:
231
257
echo "::add-mask::$(echo "$AZURE_BLOBS_TOKEN" | base64 -w 0)" &&
232
258
echo "$AZURE_BLOBS_TOKEN" >"$HOME"/.azure-blobs-token
233
259
234
- - name : Deploy Pacman packages
260
+ - name : ${{ env.BUILD_ONLY == 'true' && 'Test-deploy' || ' Deploy' }} Pacman packages
235
261
if : env.BUILD_ONLY == 'true' || env.AZURE_BLOBS_TOKEN != ''
236
262
shell : bash
237
263
env :
@@ -246,7 +272,7 @@ jobs:
246
272
run : rm -rf home
247
273
248
274
- name : mark check run as completed
249
- if : always()
275
+ if : env.CREATE_CHECK_RUN != 'false' && always()
250
276
uses : actions/github-script@v6
251
277
with :
252
278
script : |
0 commit comments