@@ -74,39 +74,64 @@ jobs:
74
74
75
75
core.setSecret(accessToken)
76
76
core.setOutput('token', accessToken)
77
- - name : set up partial Git for Windows SDK
78
- uses : git-for-windows/setup-git-for-windows-sdk@v1
77
+ - name : initialize bare SDK clone
78
+ id : clone-g4w-sdk
79
+ shell : bash
80
+ run : |
81
+ git clone --bare --depth=1 --single-branch --branch=main --filter=blob:none \
82
+ https://github.com/git-for-windows/git-sdk-64 .tmp &&
83
+ echo "rev=$(git -C .tmp rev-parse HEAD)" >>$GITHUB_OUTPUT
84
+ - name : restore cached git-sdk-64 subset
85
+ id : restore-g4w-sdk
86
+ uses : actions/cache/restore@v3
87
+ env :
88
+ cache-name : cache-g4w-sdk
79
89
with :
80
- flavor : minimal
81
- - name : download files necessary for `updpkgsums` to work
90
+ path : .sdk
91
+ key : g4w-sdk-${{ steps.clone-g4w-sdk.outputs.rev }}
92
+ - name : check out git-sdk-64 subset
93
+ if : ${{ steps.restore-g4w-sdk.outputs.cache-hit != 'true' }}
82
94
shell : bash
95
+ env :
96
+ GIT_CONFIG_PARAMETERS : " 'checkout.workers=56'"
83
97
run : |
84
- for p in \
85
- /etc/makepkg.conf \
86
- /usr/bin/gettext.exe \
87
- /usr/bin/makepkg \
88
- /usr/bin/nproc.exe \
89
- /usr/bin/pacman.exe \
90
- /usr/bin/sha256sum.exe \
91
- /usr/bin/updpkgsums
92
- do
93
- curl -sLo $p https://github.com/git-for-windows/git-sdk-64/raw/HEAD$p || exit 1
94
- done &&
95
- for p in /usr/share/makepkg
96
- do
97
- b=${p##*/} &&
98
- d=${p%/$b} &&
99
- if test "z$b" = "z$d"
100
- then
101
- d=
102
- fi &&
103
- tree=$(curl -s https://api.github.com/repos/git-for-windows/git-sdk-64/git/trees/main:${d#/} |
104
- jq -r '.tree[] | select(.path | test("^'$b'$")) | .sha') &&
105
- mkdir -p $p &&
106
- curl -sL https://github.com/git-for-windows/git-sdk-64/tarball/$tree |
107
- tar --strip-components=1 -C $p -xzvf - || exit 1
108
- done &&
109
- ln -s "${COMSPEC%cmd.exe}curl.exe" /usr/bin/
98
+ git -C .tmp config extensions.worktreeConfig true &&
99
+ git -C .tmp worktree add --no-checkout --detach "$PWD/.sdk" &&
100
+ cd .sdk &&
101
+ git config --worktree core.sparseCheckout true &&
102
+ git config --worktree core.bare false &&
103
+ sparse="$(git rev-parse --git-path info/sparse-checkout)" &&
104
+ mkdir -p "${sparse%/*}" &&
105
+ git show HEAD:.sparse/minimal-sdk >"$sparse" &&
106
+ cat >>"$sparse" <<-EOF &&
107
+ /etc/makepkg.conf
108
+ /usr/bin/gettext.exe
109
+ /usr/bin/makepkg
110
+ /usr/bin/nproc.exe
111
+ /usr/bin/pacman.exe
112
+ /usr/bin/sha256sum.exe
113
+ /usr/bin/updpkgsums
114
+ /usr/share/makepkg/
115
+ /mingw64/bin/curl.exe
116
+ EOF
117
+ git checkout -- &&
118
+
119
+ # makepkg/updpkgsums expects `curl` to be present in `/usr/bin/`
120
+ printf '#!/bin/sh\n\nexec /mingw64/bin/curl.exe "$@"' >usr/bin/curl &&
121
+
122
+ # add the SDK directories to the `PATH`
123
+ cygpath -aw "usr/bin/core_perl" >>$GITHUB_PATH &&
124
+ cygpath -aw "usr/bin" >>$GITHUB_PATH &&
125
+ cygpath -aw "mingw64/bin" >>$GITHUB_PATH &&
126
+ echo "MSYSTEM=MINGW64" >>$GITHUB_ENV
127
+ - name : cache git-sdk-64 subset
128
+ if : ${{ steps.restore-g4w-sdk.outputs.cache-hit != 'true' }}
129
+ uses : actions/cache/save@v3
130
+ env :
131
+ cache-name : cache-g4w-sdk
132
+ with :
133
+ path : .sdk
134
+ key : g4w-sdk-${{ steps.clone-g4w-sdk.outputs.rev }}
110
135
- name : Clone ${{ env.REPO }}
111
136
shell : bash
112
137
run : |
0 commit comments