-
-
Notifications
You must be signed in to change notification settings - Fork 106
165 lines (151 loc) · 5.91 KB
/
main.yml
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
name: Buildrunner
on: [push]
jobs:
build:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
env:
BUILDROOT: "buildroot_${{ matrix.platform }}"
GIT_DEPENDENCIES: tihmstar/libgeneral
MAC_DYNAMIC_LIBS: openssl,libplist
steps:
- uses: actions/checkout@v1
- name: prepre buildroot
run: mkdir $BUILDROOT
- name: Install pre-dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install -y libssl-dev
# install liblzfse
git clone https://github.com/lzfse/lzfse.git
make -C lzfse CFLAGS="-fPIC"
make -C lzfse INSTALL_PREFIX=$GITHUB_WORKSPACE/$BUILDROOT install
sudo make -C lzfse install
rm -rf lzfse
#install libplist-2.0 because libplist-dev is called "libplist v2.0.0"
git clone https://github.com/libimobiledevice/libplist
cd libplist
./autogen.sh --without-cython --enable-static --disable-shared CFLAGS="-fPIC" CXXFLAGS="-fPIC"
make
sudo make install
cd ..
rm -rf libplist
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install autoconf automake libtool pkg-config openssl libplist
cd $(brew --prefix openssl)
sudo cp -r lib/pkgconfig/* /usr/local/lib/pkgconfig/
cd $GITHUB_WORKSPACE
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
- name: download dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
get_latest_release() {
curl --silent --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
rev | cut -d '"' -f2 | rev # Pluck JSON value
}
mkdir depdir
cd depdir
mkdir $BUILDROOT
IFS=',' read -r -a deparray <<< "$GIT_DEPENDENCIES"; for d in ${deparray[@]}; do
echo "Got dependency: $d"
r=$(echo $d | cut -d '/' -f 2)
echo "Got reponame: $r"
tag=$(get_latest_release $d);
echo "Found tag: $tag"
wget "https://github.com/$d/releases/download/$tag/$BUILDROOT.zip"
unzip -u "$BUILDROOT.zip"
rm "$BUILDROOT.zip"
done
echo "moving dependencies to /"
sudo cp -r $BUILDROOT/* /
cd ..
rm -rf depdir
- name: autogen
run: ./autogen.sh --enable-static --disable-shared
- name: make
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do
echo "moving library $d"
cd $(brew --prefix $d)
find . -name "*.dylib" -exec mv {} {}.bak \;
done
cd $GITHUB_WORKSPACE
make
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do
echo "restoring library $d"
cd $(brew --prefix $d)
find . -name "*.dylib.bak" | while read f; do o=$(echo $f | rev | cut -d '.' -f2- | rev); mv $f $o; done
done
cd $GITHUB_WORKSPACE
else
make
fi
- name: make install
run: make DESTDIR=$GITHUB_WORKSPACE/$BUILDROOT install
- uses: actions/upload-artifact@v1
with:
name: ${{ env.BUILDROOT }}
path: ${{ env.BUILDROOT }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Download ubuntu artifact
uses: actions/download-artifact@v1
with:
name: buildroot_ubuntu-latest
path: buildroot_ubuntu-latest
- name: Download macos artifact
uses: actions/download-artifact@v1
with:
name: buildroot_macos-latest
path: buildroot_macos-latest
- name: Set env vars and zip
run: |
echo "BUILD_VERSION_NUM=$(echo "$(git rev-list --count HEAD | tr -d '\n')")" >> $GITHUB_ENV
echo "BUILD_VERSION_SHA=$(echo "$(git rev-parse HEAD | tr -d '\n'])")" >> $GITHUB_ENV
echo "BUILD_VERSION_STR=$(echo "$(git rev-list --count HEAD | tr -d '\n')-$(git rev-parse HEAD | tr -d '\n'])")" >> $GITHUB_ENV
echo "COMMIT_MSG=$(echo "$(git log -1 --pretty=%B)")" >> $GITHUB_ENV
zip -r buildroot_macos-latest.zip buildroot_macos-latest
zip -r buildroot_ubuntu-latest.zip buildroot_ubuntu-latest
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.BUILD_VERSION_NUM }}
release_name: Build ${{ env.BUILD_VERSION_STR }}
body: ${{ env.COMMIT_MSG }}
draft: false
prerelease: false
- name: Upload Release Asset ubuntu
id: upload-release-asset-ubuntu
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: buildroot_ubuntu-latest.zip
asset_name: buildroot_ubuntu-latest.zip
asset_content_type: application/zip
- name: Upload Release Asset macos
id: upload-release-asset-macos
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: buildroot_macos-latest.zip
asset_name: buildroot_macos-latest.zip
asset_content_type: application/zip