Skip to content

Commit 97791e8

Browse files
committed
Merge branch 'support-MINGW-and-MSYS2-packages'
Support building packages whose definitions live in `MINGW-packages` and `MSYS2-packages`, respectively. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 9da75b0 + 65bd4ae commit 97791e8

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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 }})' || '' }}
33

44
on:
55
workflow_dispatch:
@@ -16,6 +16,9 @@ on:
1616
ref:
1717
description: 'The ref containing the package definition'
1818
required: true
19+
architecture:
20+
description: 'The architecture to build for (only for MSYS packages)'
21+
required: false
1922
actor:
2023
description: The GitHub user on whose behalf this workflow is run
2124
required: false
@@ -26,9 +29,11 @@ env:
2629
OWNER: "git-for-windows"
2730
REPO: "${{ github.event.inputs.repo }}"
2831
REF: "${{ github.event.inputs.ref }}"
32+
ARCHITECTURE: "${{ github.event.inputs.architecture }}"
2933
GPG_OPTIONS: "--batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
3034
HOME: "${{ github.workspace }}\\home"
3135
ACTOR: "${{ github.event.inputs.actor || github.triggering_actor }}"
36+
CREATE_CHECK_RUN: true
3237

3338
jobs:
3439
build:
@@ -44,6 +49,7 @@ jobs:
4449
# Therefore, we registered a GitHub App and stored the data required to
4550
# act as that App in repository secrets `GH_APP_ID`, `GH_APP_PRIVATE_KEY`.
4651
- name: Obtain installation token
52+
if: env.CREATE_CHECK_RUN != 'false'
4753
id: setup
4854
uses: actions/github-script@v6
4955
with:
@@ -72,6 +78,7 @@ jobs:
7278
core.setOutput('token', accessToken)
7379
7480
- name: get check run id
81+
if: env.CREATE_CHECK_RUN != 'false'
7582
id: check-run
7683
uses: actions/github-script@v6
7784
with:
@@ -114,24 +121,34 @@ jobs:
114121
git config --global user.name "$USER_NAME" &&
115122
git config --global user.email "$USER_EMAIL" &&
116123
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"
118128
then
119129
echo "PACKAGE_TO_BUILD=mingw-w64-$PACKAGE_TO_BUILD" >>$GITHUB_ENV
120130
fi
121131
122132
- name: Download Git for Windows SDK
123133
uses: git-for-windows/setup-git-for-windows-sdk@v1
124134
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' }}
126138

127-
- name: Clone build-extra
139+
- name: Clone ${{ env.REPO }}
128140
shell: bash
129141
run: |
130142
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
135152

136153
- name: pacman -Syyu
137154
shell: bash
@@ -176,19 +193,27 @@ jobs:
176193
echo "$CODESIGN_P12" | tr % '\n' | base64 -d >home/.sig/codesign.p12 &&
177194
echo "$CODESIGN_PASS" >home/.sig/codesign.pass
178195
git config --global alias.signtool '!sh "/usr/src/build-extra/signtool.sh"'
196+
echo "SIGNTOOL=git signtool" >>$GITHUB_ENV
179197
180198
- name: Build ${{env.PACKAGE_TO_BUILD}}
181199
env:
182200
GPGKEY: ${{secrets.GPGKEY}}
201+
MAKEPKG: ${{ env.REPO != 'MSYS2-packages' && env.PACKAGE_TO_BUILD != 'git-for-windows-keyring' && 'makepkg-mingw' || 'makepkg' }}
183202
shell: bash
184203
run: |
185204
dir="$(cygpath -au artifacts)" &&
186205
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+
187212
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 &&
189214
cp *.pkg.tar* "$dir/" &&
190215
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 &&
192217
cp *.src.tar* "$dir/" &&
193218
194219
# Ensure that the Git worktree is still clean
@@ -203,6 +228,7 @@ jobs:
203228
fi
204229
205230
- name: update check-run
231+
if: env.CREATE_CHECK_RUN != 'false'
206232
uses: actions/github-script@v6
207233
with:
208234
script: |
@@ -231,7 +257,7 @@ jobs:
231257
echo "::add-mask::$(echo "$AZURE_BLOBS_TOKEN" | base64 -w 0)" &&
232258
echo "$AZURE_BLOBS_TOKEN" >"$HOME"/.azure-blobs-token
233259
234-
- name: Deploy Pacman packages
260+
- name: ${{ env.BUILD_ONLY == 'true' && 'Test-deploy' || 'Deploy' }} Pacman packages
235261
if: env.BUILD_ONLY == 'true' || env.AZURE_BLOBS_TOKEN != ''
236262
shell: bash
237263
env:
@@ -246,7 +272,7 @@ jobs:
246272
run: rm -rf home
247273

248274
- name: mark check run as completed
249-
if: always()
275+
if: env.CREATE_CHECK_RUN != 'false' && always()
250276
uses: actions/github-script@v6
251277
with:
252278
script: |

0 commit comments

Comments
 (0)