@@ -19,45 +19,55 @@ permissions:
19
19
20
20
jobs :
21
21
22
- linux-amd64-release :
22
+ linux-x86_64-all-libs :
23
23
runs-on : ubuntu-latest
24
24
steps :
25
25
- name : Checkout
26
26
uses : actions/checkout@v3
27
27
- name : Build static libraries - libgit2 compiled with libssh2 and openssl
28
28
run : |
29
- TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux \
29
+ TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs \
30
30
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
31
31
./hack/static.sh all
32
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/
33
+ mkdir -p ./libgit2-linux-all-libs /
34
+ mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs /include ./libgit2-linux-all-libs /
35
+ mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs /share ./libgit2-linux-all-libs /
36
+ mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs /lib ./libgit2-linux-all-libs /
37
+ mv ${GITHUB_WORKSPACE}/build/libgit2-linux-all-libs /lib64 ./libgit2-linux-all-libs /
38
38
39
- tar -zcvf linux-x86_64-libgit2- all-libs.tar.gz libgit2-linux-libgit2- all
39
+ tar -zcvf linux-x86_64-all-libs.tar.gz libgit2-linux-all-libs
40
40
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
41
+ - uses : actions/upload-artifact@v3
42
+ with :
43
+ name : release-artifact
44
+ path : ' *.tar.gz'
45
+ if-no-files-found : error
41
46
47
+ linux-x86_64-libgit2-only :
48
+ runs-on : ubuntu-latest
49
+ steps :
50
+ - name : Checkout
51
+ uses : actions/checkout@v3
42
52
- name : Build static libraries - libgit2 only
43
53
run : |
44
- TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux \
54
+ TARGET_DIR=${GITHUB_WORKSPACE}/build/build_libgit2_only \
45
55
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
46
56
./hack/static.sh build_libgit2_only
47
57
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/
58
+ mkdir -p ./linux-libgit2-only/
59
+ mv ${GITHUB_WORKSPACE}/build/build_libgit2_only /include ./linux-libgit2-only/
60
+ mv ${GITHUB_WORKSPACE}/build/build_libgit2_only /lib ./linux-libgit2-only/
51
61
52
- tar -zcvf linux-x86_64-libgit2-only-lib .tar.gz libgit2- linux-libgit2-only
62
+ tar -zcvf linux-x86_64-libgit2-only.tar.gz linux-libgit2-only
53
63
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
54
64
- uses : actions/upload-artifact@v3
55
65
with :
56
66
name : release-artifact
57
67
path : ' *.tar.gz'
58
68
if-no-files-found : error
59
69
60
- darwin-release :
70
+ darwin-all-libs :
61
71
# This job builds and releases "universal libraries" that are
62
72
# supported by both darwin-amd64 and darwin-arm64.
63
73
#
74
84
uses : actions/checkout@v3
75
85
- name : Build universal static libraries for Darwin - libgit2 compiled with libssh2 and openssl
76
86
run : |
77
- TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64 \
87
+ # The amd64 is used as base, using the target dir name (darwin-all-libs)
88
+ # instead of the platform specific one, removes the need of replacing the
89
+ # path in the .pc files.
90
+ TARGET_DIR=${GITHUB_WORKSPACE}/build/darwin-all-libs \
78
91
BUILD_ROOT_DIR=${GITHUB_WORKSPACE}/libgit2/build/amd \
79
92
./hack/static.sh all
80
93
@@ -84,39 +97,65 @@ jobs:
84
97
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
85
98
./hack/static.sh all
86
99
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
100
95
- libtool -static -o ./libgit2-darwin-libgit2-all/lib/libcrypto.a \
96
- ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/libcrypto.a \
101
+ LIBGIT2_SED="s;-L/Applications/Xcode_.* ;;g"
102
+ LIBGIT2PC="${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig/libgit2.pc"
103
+
104
+ # pkgconfig files may contain absolute paths to its dependencies that is specific
105
+ # to the runner - machine used to compile the library.
106
+ # We need to remove the absolute path of iconv, so when the library is consumed
107
+ # pkgconfig will automatically try to find it through the default search paths
108
+ # on the target machine.
109
+ if command -v gsed &> /dev/null; then
110
+ gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
111
+ else
112
+ sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
113
+ fi
114
+
115
+ mkdir -p ./darwin-all-libs/lib
116
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/include ./darwin-all-libs/
117
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/share ./darwin-all-libs/
118
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/cmake ./darwin-all-libs/lib/
119
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/engines-3 ./darwin-all-libs/lib/
120
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/ossl-modules ./darwin-all-libs/lib/
121
+ mv ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/pkgconfig ./darwin-all-libs/lib/
122
+
123
+ libtool -static -o ./darwin-all-libs/lib/libcrypto.a \
124
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs/lib/libcrypto.a \
97
125
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libcrypto.a
98
126
99
- libtool -static -o ./libgit2- darwin-libgit2- all/lib/libgit2.a \
100
- ${GITHUB_WORKSPACE}/build/libgit2- darwin-amd64 /lib/libgit2.a \
127
+ libtool -static -o ./darwin-all-libs /lib/libgit2.a \
128
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs /lib/libgit2.a \
101
129
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libgit2.a
102
130
103
- libtool -static -o ./libgit2- darwin-libgit2- all/lib/libssh2.a \
104
- ${GITHUB_WORKSPACE}/build/libgit2- darwin-amd64 /lib/libssh2.a \
131
+ libtool -static -o ./darwin-all-libs /lib/libssh2.a \
132
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs /lib/libssh2.a \
105
133
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libssh2.a
106
134
107
- libtool -static -o ./libgit2- darwin-libgit2- all/lib/libssl.a \
108
- ${GITHUB_WORKSPACE}/build/libgit2- darwin-amd64 /lib/libssl.a \
135
+ libtool -static -o ./darwin-all-libs /lib/libssl.a \
136
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs /lib/libssl.a \
109
137
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libssl.a
110
138
111
- libtool -static -o ./libgit2- darwin-libgit2- all/lib/libz.a \
112
- ${GITHUB_WORKSPACE}/build/libgit2- darwin-amd64 /lib/libz.a \
139
+ libtool -static -o ./darwin-all-libs /lib/libz.a \
140
+ ${GITHUB_WORKSPACE}/build/darwin-all-libs /lib/libz.a \
113
141
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libz.a
114
142
115
- tar -zcvf darwin-libgit2- all-libs.tar.gz libgit2- darwin-libgit2- all
143
+ tar -zcvf darwin-all-libs.tar.gz darwin-all-libs
116
144
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
117
145
env :
118
146
MACOSX_DEPLOYMENT_TARGET : 10.15
147
+ - uses : actions/upload-artifact@v3
148
+ with :
149
+ name : release-artifact
150
+ path : ' *.tar.gz'
151
+ if-no-files-found : error
119
152
153
+ # similar to darwin-all-libs, but only compiles libgit2.
154
+ darwin-libgit2-only :
155
+ runs-on : macos-11
156
+ steps :
157
+ - name : Checkout
158
+ uses : actions/checkout@v3
120
159
- name : Build universal static libraries for Darwin - libgit2 only
121
160
run : |
122
161
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64 \
@@ -129,14 +168,14 @@ jobs:
129
168
CMAKE_APPLE_SILICON_PROCESSOR=arm64 \
130
169
./hack/static.sh build_libgit2_only
131
170
132
- mkdir -p ./libgit2- darwin-libgit2-only/lib
133
- mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/include ./libgit2- darwin-libgit2-only/
171
+ mkdir -p ./darwin-libgit2-only/lib
172
+ mv ${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/include ./darwin-libgit2-only/
134
173
135
- libtool -static -o ./libgit2- darwin-libgit2-only/lib/libgit2.a \
174
+ libtool -static -o ./darwin-libgit2-only/lib/libgit2.a \
136
175
${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64/lib/libgit2.a \
137
176
${GITHUB_WORKSPACE}/build/libgit2-darwin-arm64/lib/libgit2.a
138
177
139
- tar -zcvf darwin-libs- libgit2-only.tar.gz libgit2- darwin-libgit2-only
178
+ tar -zcvf darwin-libgit2-only.tar.gz darwin-libgit2-only
140
179
rm -rf ${GITHUB_WORKSPACE}/build ${GITHUB_WORKSPACE}/libgit2
141
180
env :
142
181
MACOSX_DEPLOYMENT_TARGET : 10.15
@@ -148,7 +187,7 @@ jobs:
148
187
149
188
goreleaser :
150
189
runs-on : ubuntu-latest
151
- needs : [linux-amd64-release, darwin-release ]
190
+ needs : [linux-x86_64-all-libs, linux-x86_64-libgit2-only, darwin-all-libs, darwin-libgit2-only ]
152
191
if : ${{ always() && contains(join(needs.*.result, ','), 'success') }}
153
192
steps :
154
193
- uses : actions/checkout@v3
0 commit comments