@@ -12,111 +12,147 @@ on:
12
12
default : ' rc'
13
13
required : true
14
14
15
-
16
15
permissions :
17
16
contents : write # needed to write releases
18
17
id-token : write # needed for keyless signing
19
18
20
19
jobs :
21
-
22
- linux-amd64-release :
20
+ linux-x86_64-all-libs :
23
21
runs-on : ubuntu-latest
24
22
steps :
25
23
- name : Checkout
26
24
uses : actions/checkout@v3
27
25
- name : Build static libraries - libgit2 compiled with libssh2 and openssl
28
26
run : |
29
- TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux \
27
+ TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs \
30
28
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
31
29
./hack/static.sh all
32
-
33
- mkdir -p ./libgit2-linux-libgit2- all/
34
- mv ${GITHUB_WORKSPACE}/build/libgit2-linux/include ./libgit2-linux-libgit2- all/
35
- mv ${GITHUB_WORKSPACE}/build/libgit2-linux/share ./libgit2-linux-libgit2- all/
36
- mv ${GITHUB_WORKSPACE}/build/libgit2-linux/lib ./libgit2-linux-libgit2- all/
37
- mv ${GITHUB_WORKSPACE}/build/libgit2-linux/lib64 ./libgit2-linux-libgit2- all/
38
-
39
- tar -zcvf linux-x86_64-libgit2- all-libs.tar.gz libgit2-linux-libgit2- all
30
+
31
+ mkdir -p ./libgit2-linux-all-libs /
32
+ mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs /include ./libgit2-linux-all-libs /
33
+ mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs /share ./libgit2-linux-all-libs /
34
+ mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs /lib ./libgit2-linux-all-libs /
35
+ mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs /lib64 ./libgit2-linux-all-libs /
36
+
37
+ tar -zcvf linux-x86_64-all-libs.tar.gz libgit2-linux-all-libs
40
38
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
39
+ - uses : actions/upload-artifact@v3
40
+ with :
41
+ name : release-artifact
42
+ path : " *.tar.gz"
43
+ if-no-files-found : error
41
44
45
+ linux-x86_64-libgit2-only :
46
+ runs-on : ubuntu-latest
47
+ steps :
48
+ - name : Checkout
49
+ uses : actions/checkout@v3
42
50
- name : Build static libraries - libgit2 only
43
51
run : |
44
- TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux \
52
+ TARGET_DIR=${GITHUB_WORKSPACE}/build/build_libgit2_only \
45
53
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
46
54
./hack/static.sh build_libgit2_only
47
55
48
- mkdir -p ./libgit2- linux-libgit2-only/
49
- mv ${GITHUB_WORKSPACE}/build/libgit2-linux /include ./libgit2- linux-libgit2-only/
50
- mv ${GITHUB_WORKSPACE}/build/libgit2-linux /lib ./libgit2- linux-libgit2-only/
56
+ mkdir -p ./linux-libgit2-only/
57
+ mv ${GITHUB_WORKSPACE}/build/build_libgit2_only /include ./linux-libgit2-only/
58
+ mv ${GITHUB_WORKSPACE}/build/build_libgit2_only /lib ./linux-libgit2-only/
51
59
52
- tar -zcvf linux-x86_64-libgit2-only-lib .tar.gz libgit2- linux-libgit2-only
60
+ tar -zcvf linux-x86_64-libgit2-only.tar.gz linux-libgit2-only
53
61
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
54
62
- uses : actions/upload-artifact@v3
55
63
with :
56
64
name : release-artifact
57
- path : ' *.tar.gz'
65
+ path : " *.tar.gz"
58
66
if-no-files-found : error
59
67
60
- darwin-release :
68
+ darwin-all-libs :
61
69
# This job builds and releases "universal libraries" that are
62
70
# supported by both darwin-amd64 and darwin-arm64.
63
71
#
64
72
# First builds in amd64, then cross-compile in arm64. Later combining
65
73
# both outcomes onto a single binary for each static library.
66
74
#
67
75
# `macos-11` has been picked as support for arm64 was only added on Xcode 12.
68
- # Although some minor versions of Catalina 10.15 can support it, at the time
69
- # of testing, GitHub's macos-10.15 did not seem to.
76
+ # Although some minor versions of Catalina 10.15 can support it, at the time
77
+ # of testing, GitHub's macos-10.15 did not seem to.
70
78
# Cross-compiling to arm64 on that runner consistently failed.
71
79
runs-on : macos-11
72
80
steps :
73
81
- name : Checkout
74
82
uses : actions/checkout@v3
75
83
- name : Build universal static libraries for Darwin - libgit2 compiled with libssh2 and openssl
76
84
run : |
77
- TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64 \
85
+ # The amd64 is used as base, using the target dir name (darwin-all-libs)
86
+ # instead of the platform specific one, removes the need of replacing the
87
+ # path in the .pc files.
88
+ TARGET_DIR=${GITHUB_WORKSPACE}/build/darwin-all-libs \
78
89
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
79
90
./hack/static.sh all
80
-
91
+
81
92
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64 \
82
93
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/arm \
83
94
TARGET_ARCH=arm64 \
84
95
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
85
96
./hack/static.sh all
86
97
87
- mkdir -p ./libgit2-darwin-libgit2-all/lib
88
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/include ./libgit2-darwin-libgit2-all/
89
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/share ./libgit2-darwin-libgit2-all/
90
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/cmake ./libgit2-darwin-libgit2-all/lib/
91
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/engines-3 ./libgit2-darwin-libgit2-all/lib/
92
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/ossl-modules ./libgit2-darwin-libgit2-all/lib/
93
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/pkgconfig ./libgit2-darwin-libgit2-all/lib/
94
98
95
- libtool -static -o ./libgit2-darwin-libgit2-all/lib/libcrypto.a \
96
- ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/libcrypto.a \
99
+ LIBGIT2_SED="s;-L/Applications/Xcode.* ;;g"
100
+ LIBGIT2PC="${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig/libgit2.pc"
101
+
102
+ # pkgconfig includes absolute paths that are specific to the runner machine.
103
+ # We need to remove the absolute path for iconv, so when the libgit2 library
104
+ # is consumed pkgconfig will automatically try to find it through the default
105
+ # search paths on the target machine.
106
+ if command -v gsed &> /dev/null; then
107
+ gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
108
+ else
109
+ sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
110
+ fi
111
+
112
+ mkdir -p ./darwin-all-libs/lib
113
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/include ./darwin-all-libs/
114
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/share ./darwin-all-libs/
115
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/cmake ./darwin-all-libs/lib/
116
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/engines-3 ./darwin-all-libs/lib/
117
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/ossl-modules ./darwin-all-libs/lib/
118
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig ./darwin-all-libs/lib/
119
+
120
+ libtool -static -o ./darwin-all-libs/lib/libcrypto.a \
121
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libcrypto.a \
97
122
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libcrypto.a
98
123
99
- libtool -static -o ./libgit2- darwin-libgit2- all/lib/libgit2.a \
100
- ${GITHUB_WORKSPACE}/build/libgit2- darwin-amd64 /lib/libgit2.a \
124
+ libtool -static -o ./darwin-all-libs /lib/libgit2.a \
125
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs /lib/libgit2.a \
101
126
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libgit2.a
102
127
103
- libtool -static -o ./libgit2- darwin-libgit2- all/lib/libssh2.a \
104
- ${GITHUB_WORKSPACE}/build/libgit2- darwin-amd64 /lib/libssh2.a \
128
+ libtool -static -o ./darwin-all-libs /lib/libssh2.a \
129
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs /lib/libssh2.a \
105
130
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libssh2.a
106
131
107
- libtool -static -o ./libgit2- darwin-libgit2- all/lib/libssl.a \
108
- ${GITHUB_WORKSPACE}/build/libgit2- darwin-amd64 /lib/libssl.a \
132
+ libtool -static -o ./darwin-all-libs /lib/libssl.a \
133
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs /lib/libssl.a \
109
134
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libssl.a
110
135
111
- libtool -static -o ./libgit2- darwin-libgit2- all/lib/libz.a \
112
- ${GITHUB_WORKSPACE}/build/libgit2- darwin-amd64 /lib/libz.a \
136
+ libtool -static -o ./darwin-all-libs /lib/libz.a \
137
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs /lib/libz.a \
113
138
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libz.a
114
139
115
- tar -zcvf darwin-libgit2- all-libs.tar.gz libgit2- darwin-libgit2- all
140
+ tar -zcvf darwin-all-libs.tar.gz darwin-all-libs
116
141
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
117
142
env :
118
143
MACOSX_DEPLOYMENT_TARGET : 10.15
144
+ - uses : actions/upload-artifact@v3
145
+ with :
146
+ name : release-artifact
147
+ path : " *.tar.gz"
148
+ if-no-files-found : error
119
149
150
+ # similar to darwin-all-libs, but only compiles libgit2.
151
+ darwin-libgit2-only :
152
+ runs-on : macos-11
153
+ steps :
154
+ - name : Checkout
155
+ uses : actions/checkout@v3
120
156
- name : Build universal static libraries for Darwin - libgit2 only
121
157
run : |
122
158
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64 \
@@ -129,27 +165,46 @@ jobs:
129
165
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
130
166
./hack/static.sh build_libgit2_only
131
167
132
- mkdir -p ./libgit2-darwin-libgit2-only/lib
133
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/include ./libgit2-darwin-libgit2-only/
168
+ LIBGIT2_SED="s;-L/Applications/Xcode.* ;;g"
169
+ LIBGIT2PC="${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/pkgconfig/libgit2.pc"
170
+
171
+ # pkgconfig includes absolute paths that are specific to the runner machine.
172
+ # We need to remove the absolute path for iconv, so when the libgit2 library
173
+ # is consumed pkgconfig will automatically try to find it through the default
174
+ # search paths on the target machine.
175
+ if command -v gsed &> /dev/null; then
176
+ gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
177
+ else
178
+ sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
179
+ fi
180
+
181
+ mkdir -p ./darwin-libgit2-only/lib
182
+ mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/include ./darwin-libgit2-only/
134
183
135
- libtool -static -o ./libgit2- darwin-libgit2-only/lib/libgit2.a \
184
+ libtool -static -o ./darwin-libgit2-only/lib/libgit2.a \
136
185
${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/libgit2.a \
137
186
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libgit2.a
138
187
139
- tar -zcvf darwin-libs- libgit2-only.tar.gz libgit2- darwin-libgit2-only
188
+ tar -zcvf darwin-libgit2-only.tar.gz darwin-libgit2-only
140
189
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
141
190
env :
142
191
MACOSX_DEPLOYMENT_TARGET : 10.15
143
192
- uses : actions/upload-artifact@v3
144
193
with :
145
194
name : release-artifact
146
- path : ' *.tar.gz'
195
+ path : " *.tar.gz"
147
196
if-no-files-found : error
148
197
149
198
goreleaser :
150
199
runs-on : ubuntu-latest
151
- needs : [linux-amd64-release, darwin-release]
152
- if : ${{ always() && contains(join(needs.*.result, ','), 'success') }}
200
+ needs :
201
+ [
202
+ linux-x86_64-all-libs,
203
+ linux-x86_64-libgit2-only,
204
+ darwin-all-libs,
205
+ darwin-libgit2-only,
206
+ ]
207
+ if : ${{ always() && contains(join(needs.*.result, ','), 'success') }}
153
208
steps :
154
209
- uses : actions/checkout@v3
155
210
with :
0 commit comments