6
6
- workflow_dispatch
7
7
8
8
env :
9
+ GPG_OPTIONS : " --batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
9
10
HOME : " ${{github.workspace}}\\ home"
10
11
MSYSTEM : MINGW64
11
12
USERPROFILE : " ${{github.workspace}}\\ home"
44
45
run : |
45
46
d=git-sdk-64-build-installers/usr/src/build-extra &&
46
47
git clone --single-branch -b main https://github.com/git-for-windows/build-extra $d
48
+ - name : Prepare home directory for GPG signing
49
+ if : env.GPGKEY != ''
50
+ shell : bash
51
+ run : |
52
+ echo '${{secrets.PRIVGPGKEY}}' | tr % '\n' | gpg $GPG_OPTIONS --import &&
53
+ mkdir -p home &&
54
+ git config --global gpg.program "$PWD/git-sdk-64-build-installers/usr/src/build-extra/gnupg-with-gpgkey.sh" &&
55
+ info="$(gpg --list-keys --with-colons "${GPGKEY%% *}" | cut -d : -f 1,10 | sed -n '/^uid/{s|uid:||p;q}')" &&
56
+ git config --global user.name "${info% <*}" &&
57
+ git config --global user.email "<${info#*<}"
58
+ env :
59
+ GPGKEY : ${{secrets.GPGKEY}}
47
60
- name : Generate bundle artifacts
61
+ env :
62
+ GPGKEY : ${{secrets.GPGKEY}}
48
63
shell : powershell
49
64
run : |
50
65
& .\git-sdk-64-build-installers\git-cmd.exe --command=usr\bin\bash.exe -lc @"
@@ -59,12 +74,16 @@ jobs:
59
74
echo \"prerelease-`${tag_name#v}\" >bundle-artifacts/ver &&
60
75
echo \"`${tag_name#v}\" >bundle-artifacts/display_version &&
61
76
echo \"`$tag_name\" >bundle-artifacts/next_version &&
62
- git tag -m \"Snapshot build\" \"`$tag_name\" FETCH_HEAD &&
77
+ git tag `$(test -z \"`$GPGKEY\" || echo \" -s\") -m \"Snapshot build\" \"`$tag_name\" FETCH_HEAD &&
63
78
git bundle create bundle-artifacts/git.bundle origin/main..\"`$tag_name\" &&
64
79
65
80
sh -x /usr/src/build-extra/please.sh mention feature \"Snapshot of `$(git show -s --pretty='tformat:%h (%s, %ad)' --date=short FETCH_HEAD)\" &&
66
81
git -C /usr/src/build-extra bundle create \"`$PWD/bundle-artifacts/build-extra.bundle\" origin/main..main
67
82
"@
83
+ - name : Clean up temporary files
84
+ if : always()
85
+ shell : bash
86
+ run : rm -rf home
68
87
- name : ' Publish Pipeline Artifact: bundle-artifacts'
69
88
uses : actions/upload-artifact@v1
70
89
with :
@@ -116,7 +135,19 @@ jobs:
116
135
git remote add -f origin https://github.com/git-for-windows/git &&
117
136
git fetch --tags bundle-artifacts/git.bundle $(cat bundle-artifacts/next_version) &&
118
137
git reset --hard $(cat bundle-artifacts/next_version)
138
+ - name : Prepare home directory for GPG signing
139
+ if : env.GPGKEY != ''
140
+ shell : bash
141
+ run : |
142
+ echo '${{secrets.PRIVGPGKEY}}' | tr % '\n' | gpg $GPG_OPTIONS --import &&
143
+ info="$(gpg --list-keys --with-colons "${GPGKEY%% *}" | cut -d : -f 1,10 | sed -n '/^uid/{s|uid:||p;q}')" &&
144
+ git config --global user.name "${info% <*}" &&
145
+ git config --global user.email "<${info#*<}"
146
+ env :
147
+ GPGKEY : ${{secrets.GPGKEY}}
119
148
- name : Build mingw-w64-x86_64-git
149
+ env :
150
+ GPGKEY : " ${{secrets.GPGKEY}}"
120
151
shell : powershell
121
152
run : |
122
153
& git-sdk-64-makepkg-git\usr\bin\sh.exe -lc @"
@@ -126,6 +157,13 @@ jobs:
126
157
type -p mspdb140.dll || exit 1
127
158
sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-64-bit --build-src-pkg -o artifacts HEAD &&
128
159
cp bundle-artifacts/ver artifacts/ &&
160
+ if test -n \"`$GPGKEY\"
161
+ then
162
+ for tar in artifacts/*.tar*
163
+ do
164
+ /usr/src/build-extra/gnupg-with-gpgkey.sh --detach-sign --no-armor `$tar
165
+ done
166
+ fi &&
129
167
130
168
b=`$PWD/artifacts &&
131
169
version=`$(cat bundle-artifacts/next_version) &&
@@ -134,6 +172,10 @@ jobs:
134
172
git commit -s -m \"mingw-w64-git: new version (`$version)\" PKGBUILD &&
135
173
git bundle create \"`$b\"/MINGW-packages.bundle origin/main..main)
136
174
"@
175
+ - name : Clean up temporary files
176
+ if : always()
177
+ shell : bash
178
+ run : rm -rf home
137
179
- name : Publish mingw-w64-x86_64-git
138
180
uses : actions/upload-artifact@v1
139
181
with :
0 commit comments