This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
292 lines (285 loc) · 13.6 KB
/
build_git.yaml
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
## Too much of a headache, a zillion binaries and all of them require custom config.
# Use: jj git --> https://github.com/martinvonz/jj
name: ⚙️ Build Git Binaries 📦
#MAX_RUNTIME: 10 Minutes
#REF: https://github.com/darkvertex/static-git/blob/main/.github/workflows/build.yml
on:
workflow_dispatch:
#schedule:
# - cron: "15 18 * * *" # 12:00 AM Nepal Time Midnight EveryDay
env:
GITHUB_TOKEN: ${{ secrets.STATIC_TOOLBOX }}
jobs:
#------------------------------------------------------------------------------------#
build-x86-64:
name: Build Git (ARCH=x86-64)
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install CoreUtils & Deps
run: |
#Presets
set -x ; set +e
#--------------#
sudo apt-get update -y
sudo apt-get install automake b3sum build-essential ca-certificates ccache lzip jq make musl musl-dev musl-tools p7zip-full wget -y
sudo apt-get install curl autoconf bison devscripts flex gcc make bash cmake gettext g++ libtool musl-dev tcl tcl-dev tk -y
#for https & ssl support
sudo apt-get install libcurl4-openssl-dev -y
#eget
sudo curl -qfsSL "https://bin.ajam.dev/x86_64_Linux/eget" -o "/usr/local/bin/eget" && sudo chmod +xwr "/usr/local/bin/eget"
continue-on-error: true
- name: Build Git
run: |
set -x ; set +e
# Git Clone Repo
cd $(mktemp -d) && git clone https://github.com/git/git
cd "./git"
# Export Version
export VERSION=$(git tag --sort=-creatordate | head -n 1)
echo "VERSION=$VERSION" >> $GITHUB_ENV
export RELEASE_VERSION=$(git tag --sort=-creatordate | head -n 1 | sed 's/^v//; s/-.*$//')
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
# Configure
make configure && sed -i 's/qversion/-version/g' configure
# Prefix
./configure prefix="/usr" LDFLAGS="--static" CFLAGS="${CFLAGS} -static" && cat config.log
# make
make -j$(nproc) && make install
# Move Binaries
mkdir "./git_binaries"
mv "git" "./git_binaries"
mv "git-add" "./git_binaries"
mv "git-am" "./git_binaries"
mv "git-annotate" "./git_binaries"
mv "git-apply" "./git_binaries"
mv "git-archimport" "./git_binaries"
mv "git-archive" "./git_binaries"
mv "git-bisect" "./git_binaries"
mv "git-blame" "./git_binaries"
mv "git-branch" "./git_binaries"
mv "git-bugreport" "./git_binaries"
mv "git-bundle" "./git_binaries"
mv "git-cat-file" "./git_binaries"
mv "git-check-attr" "./git_binaries"
mv "git-check-ignore" "./git_binaries"
mv "git-check-mailmap" "./git_binaries"
mv "git-checkout" "./git_binaries"
mv "git-checkout-index" "./git_binaries"
mv "git-checkout--worker" "./git_binaries"
mv "git-check-ref-format" "./git_binaries"
mv "git-cherry" "./git_binaries"
mv "git-cherry-pick" "./git_binaries"
mv "git-clean" "./git_binaries"
mv "git-clone" "./git_binaries"
mv "git-column" "./git_binaries"
mv "git-commit" "./git_binaries"
mv "git-commit-graph" "./git_binaries"
mv "git-commit-tree" "./git_binaries"
mv "git-config" "./git_binaries"
mv "git-count-objects" "./git_binaries"
mv "git-credential" "./git_binaries"
mv "git-credential-cache" "./git_binaries"
mv "git-credential-cache--daemon" "./git_binaries"
mv "git-credential-store" "./git_binaries"
mv "git-cvsexportcommit" "./git_binaries"
mv "git-cvsimport" "./git_binaries"
mv "git-cvsserver" "./git_binaries"
mv "git-daemon" "./git_binaries"
mv "git-describe" "./git_binaries"
mv "git-diagnose" "./git_binaries"
mv "git-diff" "./git_binaries"
mv "git-diff-files" "./git_binaries"
mv "git-diff-index" "./git_binaries"
mv "git-difftool" "./git_binaries"
mv "git-difftool--helper" "./git_binaries"
mv "git-diff-tree" "./git_binaries"
mv "git-fast-export" "./git_binaries"
mv "git-fast-import" "./git_binaries"
mv "git-fetch" "./git_binaries"
mv "git-fetch-pack" "./git_binaries"
mv "git-filter-branch" "./git_binaries"
mv "git-fmt-merge-msg" "./git_binaries"
mv "git-for-each-ref" "./git_binaries"
mv "git-for-each-repo" "./git_binaries"
mv "git-format-patch" "./git_binaries"
mv "git-fsck" "./git_binaries"
mv "git-fsck-objects" "./git_binaries"
mv "git-fsmonitor--daemon" "./git_binaries"
mv "git-gc" "./git_binaries"
mv "git-get-tar-commit-id" "./git_binaries"
mv "git-grep" "./git_binaries"
mv "git-hash-object" "./git_binaries"
mv "git-help" "./git_binaries"
mv "git-hook" "./git_binaries"
mv "git-http-backend" "./git_binaries"
mv "git-imap-send" "./git_binaries"
mv "git-index-pack" "./git_binaries"
mv "git-init" "./git_binaries"
mv "git-init-db" "./git_binaries"
mv "git-instaweb" "./git_binaries"
mv "git-interpret-trailers" "./git_binaries"
mv "git-log" "./git_binaries"
mv "git-ls-files" "./git_binaries"
mv "git-ls-remote" "./git_binaries"
mv "git-ls-tree" "./git_binaries"
mv "git-mailinfo" "./git_binaries"
mv "git-mailsplit" "./git_binaries"
mv "git-maintenance" "./git_binaries"
mv "git-merge" "./git_binaries"
mv "git-merge-base" "./git_binaries"
mv "git-merge-file" "./git_binaries"
mv "git-merge-index" "./git_binaries"
mv "git-merge-octopus" "./git_binaries"
mv "git-merge-one-file" "./git_binaries"
mv "git-merge-ours" "./git_binaries"
mv "git-merge-recursive" "./git_binaries"
mv "git-merge-resolve" "./git_binaries"
mv "git-merge-subtree" "./git_binaries"
mv "git-mergetool" "./git_binaries"
mv "git-mergetool--lib" "./git_binaries"
mv "git-merge-tree" "./git_binaries"
mv "git-mktag" "./git_binaries"
mv "git-mktree" "./git_binaries"
mv "git-multi-pack-index" "./git_binaries"
mv "git-mv" "./git_binaries"
mv "git-name-rev" "./git_binaries"
mv "git-notes" "./git_binaries"
mv "git-p4" "./git_binaries"
mv "git-pack-objects" "./git_binaries"
mv "git-pack-redundant" "./git_binaries"
mv "git-pack-refs" "./git_binaries"
mv "git-patch-id" "./git_binaries"
mv "git-prune" "./git_binaries"
mv "git-prune-packed" "./git_binaries"
mv "git-pull" "./git_binaries"
mv "git-push" "./git_binaries"
mv "git-quiltimport" "./git_binaries"
mv "git-range-diff" "./git_binaries"
mv "git-read-tree" "./git_binaries"
mv "git-rebase" "./git_binaries"
mv "git-receive-pack" "./git_binaries"
mv "git-reflog" "./git_binaries"
mv "git-remote" "./git_binaries"
mv "git-remote-ext" "./git_binaries"
mv "git-remote-fd" "./git_binaries"
mv "git-repack" "./git_binaries"
mv "git-replace" "./git_binaries"
mv "git-request-pull" "./git_binaries"
mv "git-rerere" "./git_binaries"
mv "git-reset" "./git_binaries"
mv "git-restore" "./git_binaries"
mv "git-revert" "./git_binaries"
mv "git-rev-list" "./git_binaries"
mv "git-rev-parse" "./git_binaries"
mv "git-rm" "./git_binaries"
mv "git-send-email" "./git_binaries"
mv "git-send-pack" "./git_binaries"
mv "git-shell" "./git_binaries"
mv "git-sh-i18n" "./git_binaries"
mv "git-sh-i18n--envsubst" "./git_binaries"
mv "git-shortlog" "./git_binaries"
mv "git-show" "./git_binaries"
mv "git-show-branch" "./git_binaries"
mv "git-show-index" "./git_binaries"
mv "git-show-ref" "./git_binaries"
mv "git-sh-setup" "./git_binaries"
mv "git-sparse-checkout" "./git_binaries"
mv "git-stage" "./git_binaries"
mv "git-stash" "./git_binaries"
mv "git-status" "./git_binaries"
mv "git-stripspace" "./git_binaries"
mv "git-submodule" "./git_binaries"
mv "git-submodule--helper" "./git_binaries"
mv "git-svn" "./git_binaries"
mv "git-switch" "./git_binaries"
mv "git-symbolic-ref" "./git_binaries"
mv "git-tag" "./git_binaries"
mv "git-unpack-file" "./git_binaries"
mv "git-unpack-objects" "./git_binaries"
mv "git-update-index" "./git_binaries"
mv "git-update-ref" "./git_binaries"
mv "git-update-server-info" "./git_binaries"
mv "git-upload-archive" "./git_binaries"
mv "git-upload-pack" "./git_binaries"
mv "git-var" "./git_binaries"
mv "git-verify-commit" "./git_binaries"
mv "git-verify-pack" "./git_binaries"
mv "git-verify-tag" "./git_binaries"
mv "git-version" "./git_binaries"
mv "git-web--browse" "./git_binaries"
mv "git-whatchanged" "./git_binaries"
mv "git-worktree" "./git_binaries"
mv "git-write-tree" "./git_binaries"
mv "scalar" "./git_binaries"
#git-lfs
eget "git-lfs/git-lfs" --asset "linux" --asset "64" --asset "^arm" --file "git-lfs" --to "./git_binaries/git-lfs"
# Strip the binaries
find ./git_binaries -type f -exec strip {} \;
sha256sum ./git_binaries/*
#/usr/share/git-core/templates
mkdir "./git-templates"
mv "./templates/." "./git-templates"
# Put Everything in a single Tar
tar -czvf /tmp/git_binaries_amd_x86_64_Linux.tar.gz ./git_binaries*
tar -czvf /tmp/git_templates_amd_x86_64_Linux.tar.gz ./git-templates*
# Rename
pushd "./git_binaries"
find . -type f -exec sh -c 'new_name=$(echo "{}" | sed "s/-/_/g; s/$/_amd_x86_64_Linux/"); mv "{}" "./$new_name"' \;
sha256sum * ; popd
# Prepare for Release
mkdir -p /tmp/releases
mv ./git_binaries/* /tmp/releases
mv "/tmp/git_binaries_amd_x86_64_Linux.tar.gz" /tmp/releases
mv "/tmp/git_templates_amd_x86_64_Linux.tar.gz" /tmp/releases
continue-on-error: true
- name: Create Body for Release
run: |
set +e
cd /tmp/releases
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '---' >> /tmp/RELEASE_NOTE.md
echo '```console' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo "Changelog: 'https://github.com/git/git/blob/master/Documentation/RelNotes/$RELEASE_VERSION.txt'" >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo -e "--> METADATA" >> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; file * | grep -v '.txt' '&>> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo -e "--> SHA256SUM" >> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ ";sha256sum * | grep -v '.txt' ' &>> /tmp/RELEASE_NOTE.md
echo -e '```\n' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '---' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '- #### Version' >> /tmp/RELEASE_NOTE.md
echo '```console' >> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; ./git_amd_x86_64_Linux --version' &>> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; ./git_amd_x86_64_Linux --help' &>> /tmp/RELEASE_NOTE.md
echo '```' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '---' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '- #### Sizes' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '```console' >> /tmp/RELEASE_NOTE.md
/bin/bash -c 'PS4="$ "; ls -lh ./* | grep -v '.txt' | awk "{print \$5, \$9}" | column -t' &>> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
echo '```' >> /tmp/RELEASE_NOTE.md
echo -e "" >> /tmp/RELEASE_NOTE.md
continue-on-error: true
- name: Releaser
uses: softprops/action-gh-release@v0.1.15
with:
name: "Git ${{ env.VERSION }}"
tag_name: "git-${{ env.VERSION }}"
prerelease: false
draft: false
generate_release_notes: false
token: "${{ secrets.GITHUB_TOKEN }}"
body_path: "/tmp/RELEASE_NOTE.md"
files: |
/tmp/releases/*
#------------------------------------------------------------------------------------#