Skip to content

Commit ac4d161

Browse files
committed
fix ci
1 parent bf2289d commit ac4d161

File tree

1 file changed

+63
-93
lines changed

1 file changed

+63
-93
lines changed

.github/workflows/main.yml

+63-93
Original file line numberDiff line numberDiff line change
@@ -11,115 +11,102 @@ jobs:
1111
runs-on: ${{ matrix.platform }}
1212
env:
1313
BUILDROOT: "buildroot_${{ matrix.platform }}"
14-
GIT_DEPENDENCIES: tihmstar/libgeneral
15-
MAC_DYNAMIC_LIBS: openssl,libplist
16-
14+
GIT_DEPENDENCIES: libgeneral,libplist
15+
MAC_DYNAMIC_LIBS: openssl
16+
1717
steps:
18-
- uses: actions/checkout@v1
19-
- name: prepre buildroot
20-
run: mkdir $BUILDROOT
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
2121
- name: Install pre-dependencies
22-
run: |
22+
run: |
2323
if [ "$RUNNER_OS" == "Linux" ]; then
24-
sudo apt-get install -y libssl-dev
25-
26-
# install liblzfse
27-
git clone https://github.com/lzfse/lzfse.git
28-
make -C lzfse CFLAGS="-fPIC"
29-
make -C lzfse INSTALL_PREFIX=$GITHUB_WORKSPACE/$BUILDROOT install
30-
sudo make -C lzfse install
31-
rm -rf lzfse
32-
33-
#install libplist-2.0 because libplist-dev is called "libplist v2.0.0"
34-
git clone https://github.com/libimobiledevice/libplist
35-
cd libplist
36-
./autogen.sh --without-cython --enable-static --disable-shared CFLAGS="-fPIC" CXXFLAGS="-fPIC"
37-
make
38-
sudo make install
39-
cd ..
40-
rm -rf libplist
41-
24+
sudo apt-get update
25+
sudo apt-get install -y jq libssl-dev
26+
27+
# install liblzfse
28+
git clone https://github.com/lzfse/lzfse.git
29+
make -C lzfse CFLAGS="-fPIC"
30+
make -C lzfse INSTALL_PREFIX=$GITHUB_WORKSPACE/$BUILDROOT install
31+
sudo make -C lzfse install
32+
rm -rf lzfse
33+
4234
elif [ "$RUNNER_OS" == "macOS" ]; then
43-
brew install autoconf automake libtool pkg-config openssl libplist
44-
45-
cd $(brew --prefix openssl)
46-
sudo cp -r lib/pkgconfig/* /usr/local/lib/pkgconfig/
47-
cd $GITHUB_WORKSPACE
48-
35+
brew install autoconf automake libtool jq pkg-config
36+
brew install openssl
37+
38+
cd $(brew --prefix openssl)
39+
sudo cp -r lib/pkgconfig/* /usr/local/lib/pkgconfig/
40+
41+
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do
42+
echo "moving library $d"
43+
cd $(brew --prefix $d)
44+
find . -name "*.dylib" -exec mv {} {}.bak \;
45+
done
46+
cd $GITHUB_WORKSPACE
47+
4948
else
50-
echo "$RUNNER_OS not supported"
51-
exit 1
49+
echo "$RUNNER_OS not supported"
50+
exit 1
5251
fi
5352
shell: bash
5453
- name: download dependencies
5554
env:
5655
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5756
run: |
5857
get_latest_release() {
59-
curl --silent --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
60-
grep '"tag_name":' | # Get tag line
61-
rev | cut -d '"' -f2 | rev # Pluck JSON value
58+
url="https://api.github.com/repos/$1/releases/latest"
59+
echo "url: ${url}" >&2
60+
curl --silent --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "${url}" | # Get latest release from GitHub api
61+
jq .tag_name | # Get tag
62+
tr -d '"' # Strip quotes
6263
}
6364
mkdir depdir
6465
cd depdir
6566
mkdir $BUILDROOT
66-
IFS=',' read -r -a deparray <<< "$GIT_DEPENDENCIES"; for d in ${deparray[@]}; do
67-
echo "Got dependency: $d"
68-
r=$(echo $d | cut -d '/' -f 2)
69-
echo "Got reponame: $r"
70-
tag=$(get_latest_release $d);
67+
IFS=',' read -r -a deparray <<< "$GIT_DEPENDENCIES"; for d in ${deparray[@]}; do
68+
dep=$d
69+
if ! echo ${dep} | grep -q '/'; then
70+
dep=${{ github.repository_owner }}/${dep}
71+
fi
72+
echo "Got dependency: ${dep}"
73+
tag=$(get_latest_release ${dep});
7174
echo "Found tag: $tag"
72-
wget "https://github.com/$d/releases/download/$tag/$BUILDROOT.zip"
75+
wget "https://github.com/${dep}/releases/download/$tag/$BUILDROOT.zip"
7376
unzip -u "$BUILDROOT.zip"
7477
rm "$BUILDROOT.zip"
7578
done
7679
echo "moving dependencies to /"
7780
sudo cp -r $BUILDROOT/* /
7881
cd ..
7982
rm -rf depdir
83+
- name: prepre buildroot
84+
run: mkdir -p $BUILDROOT
8085
- name: autogen
8186
run: ./autogen.sh --enable-static --disable-shared
8287
- name: make
83-
run: |
84-
if [ "$RUNNER_OS" == "macOS" ]; then
85-
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do
86-
echo "moving library $d"
87-
cd $(brew --prefix $d)
88-
find . -name "*.dylib" -exec mv {} {}.bak \;
89-
done
90-
cd $GITHUB_WORKSPACE
91-
92-
make
93-
94-
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do
95-
echo "restoring library $d"
96-
cd $(brew --prefix $d)
97-
find . -name "*.dylib.bak" | while read f; do o=$(echo $f | rev | cut -d '.' -f2- | rev); mv $f $o; done
98-
done
99-
cd $GITHUB_WORKSPACE
100-
else
101-
make
102-
fi
88+
run: make -j || make
10389
- name: make install
104-
run: make DESTDIR=$GITHUB_WORKSPACE/$BUILDROOT install
105-
- uses: actions/upload-artifact@v1
90+
run: make DESTDIR=$GITHUB_WORKSPACE/$BUILDROOT install
91+
- uses: actions/upload-artifact@v4
10692
with:
10793
name: ${{ env.BUILDROOT }}
10894
path: ${{ env.BUILDROOT }}
10995

11096
release:
11197
needs: build
11298
runs-on: ubuntu-latest
113-
11499
steps:
115-
- uses: actions/checkout@v1
100+
- uses: actions/checkout@v4
101+
with:
102+
fetch-depth: 0
116103
- name: Download ubuntu artifact
117-
uses: actions/download-artifact@v1
104+
uses: actions/download-artifact@v4
118105
with:
119106
name: buildroot_ubuntu-latest
120107
path: buildroot_ubuntu-latest
121108
- name: Download macos artifact
122-
uses: actions/download-artifact@v1
109+
uses: actions/download-artifact@v4
123110
with:
124111
name: buildroot_macos-latest
125112
path: buildroot_macos-latest
@@ -133,33 +120,16 @@ jobs:
133120
zip -r buildroot_ubuntu-latest.zip buildroot_ubuntu-latest
134121
- name: Create Release
135122
id: create_release
136-
uses: actions/[email protected]
123+
uses: softprops/action-gh-release@v2
124+
if: github.ref == 'refs/heads/master'
137125
env:
138126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139127
with:
128+
prerelease: false
129+
draft: false
140130
tag_name: ${{ env.BUILD_VERSION_NUM }}
141-
release_name: Build ${{ env.BUILD_VERSION_STR }}
131+
name: Build ${{ env.BUILD_VERSION_STR }}
142132
body: ${{ env.COMMIT_MSG }}
143-
draft: false
144-
prerelease: false
145-
- name: Upload Release Asset ubuntu
146-
id: upload-release-asset-ubuntu
147-
uses: actions/[email protected]
148-
env:
149-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
150-
with:
151-
upload_url: ${{ steps.create_release.outputs.upload_url }}
152-
asset_path: buildroot_ubuntu-latest.zip
153-
asset_name: buildroot_ubuntu-latest.zip
154-
asset_content_type: application/zip
155-
- name: Upload Release Asset macos
156-
id: upload-release-asset-macos
157-
uses: actions/[email protected]
158-
env:
159-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160-
with:
161-
upload_url: ${{ steps.create_release.outputs.upload_url }}
162-
asset_path: buildroot_macos-latest.zip
163-
asset_name: buildroot_macos-latest.zip
164-
asset_content_type: application/zip
165-
133+
files: |
134+
buildroot_ubuntu-latest.zip
135+
buildroot_macos-latest.zip

0 commit comments

Comments
 (0)