Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit 618f7d2

Browse files
committed
add ci script
1 parent 07c66f3 commit 618f7d2

File tree

3 files changed

+75
-8
lines changed

3 files changed

+75
-8
lines changed

.github/workflows/bundle.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#/bin/sh
2+
set -e
3+
PACKAGE=tesseract-ocr
4+
5+
# Update
6+
pacman -Syy --noconfirm
7+
OUTPUT=$(mktemp -d)
8+
9+
# Download files (-dd skips dependencies)
10+
pkgs=$(echo mingw-w64-{i686,x86_64,ucrt-x86_64}-${PACKAGE})
11+
deps=$(pacman -Si $pkgs | grep 'Depends On' | grep -o 'mingw-w64-[_.a-z0-9-]*')
12+
URLS=$(pacman -Sp $pkgs $deps --cache=$OUTPUT)
13+
VERSION=$(pacman -Si mingw-w64-x86_64-${PACKAGE} | awk '/^Version/{print $3}')
14+
15+
# Set version for next step
16+
echo "::set-output name=VERSION::${VERSION}"
17+
echo "::set-output name=PACKAGE::${PACKAGE}"
18+
echo "Bundling $PACKAGE-$VERSION"
19+
echo "# $PACKAGE $VERSION" > README.md
20+
echo "" >> README.md
21+
22+
for URL in $URLS; do
23+
curl -OLs $URL
24+
FILE=$(basename $URL)
25+
echo "Extracting: $URL"
26+
echo " - $FILE" >> README.md
27+
tar xf $FILE -C ${OUTPUT}
28+
rm -f $FILE
29+
done
30+
31+
# Remove stuff we don't need
32+
rm -Rf ${OUTPUT}/*/lib/{gettext,pkgconfig,cmake}
33+
#rm -fv ${OUTPUT}/*/lib/lib{asprintf,charset,iconv,intl,gettext*,gnurx,hogweed,ssl,tre,systre}.a
34+
35+
# Put into dir structure
36+
rm -Rf lib lib-8.3.0 include share
37+
mkdir -p lib lib-8.3.0 include share
38+
cp -Rf ${OUTPUT}/mingw64/include/{tesseract,leptonica} include/
39+
cp -Rf ${OUTPUT}/mingw64/share/tessdata share/
40+
cp -Rf ${OUTPUT}/mingw64/lib lib-8.3.0/x64
41+
cp -Rf ${OUTPUT}/mingw32/lib lib-8.3.0/i386
42+
cp -Rf ${OUTPUT}/ucrt64/lib lib/x64
43+
ls -ltrRh .
44+
45+
# Cleanup
46+
rm -Rf ${OUTPUT}

.github/workflows/bundle.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: bundle binaries
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: windows-latest
9+
steps:
10+
- name: Prepare git
11+
run: |
12+
git config --global core.autocrlf false
13+
git config --global user.email '[email protected]'
14+
git config --global user.name 'Jeroen Ooms (via CI)'
15+
- uses: actions/checkout@v2
16+
- id: download
17+
name: Download libraries
18+
run: |
19+
cd $(cygpath ${GITHUB_WORKSPACE})
20+
.github/workflows/bundle.sh
21+
shell: c:\rtools40\usr\bin\bash.exe --login {0}
22+
- name: Push binaries
23+
run: |
24+
version=${{ steps.download.outputs.VERSION }}
25+
git add README.md include share lib*
26+
git commit -m "Bundle $version ($(date +%F))" || exit 0
27+
git tag $version
28+
git push origin master $version
29+
shell: bash

readme.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)