diff --git a/.github/workflows/bundle.sh b/.github/workflows/bundle.sh new file mode 100644 index 0000000..a805a29 --- /dev/null +++ b/.github/workflows/bundle.sh @@ -0,0 +1,42 @@ +#/bin/sh +set -e +PACKAGE=imagemagick + +# Update +pacman -Sy +OUTPUT=$(mktemp -d) + +# Download files (-dd skips dependencies) +pkgs=$(echo mingw-w64-{i686,x86_64,ucrt-x86_64}-${PACKAGE}) +deps=$(pacman -Si $pkgs | grep 'Depends On' | grep -o 'mingw-w64-[_.a-z0-9-]*') +URLS=$(pacman -Sp $pkgs $deps --cache=$OUTPUT) +VERSION=$(pacman -Si mingw-w64-x86_64-${PACKAGE} | awk '/^Version/{print $3}') + +# Set version for next step +echo "::set-output name=VERSION::${VERSION}" +echo "::set-output name=PACKAGE::${PACKAGE}" +echo "Bundling $PACKAGE-$VERSION" +echo "# $PACKAGE $VERSION" > README.md +echo "" >> README.md + +for URL in $URLS; do + curl -OLs $URL + FILE=$(basename $URL) + echo "Extracting: $FILE" + echo " - $FILE" >> readme.md + tar xf $FILE -C ${OUTPUT} + unlink $FILE +done +rm -Rf lib lib-8.3.0 lib-4.9.3 include include-4.9.3 include-config mingw-w64-imagemagick config.status +mkdir -p lib-8.3.0 +mkdir -p lib +cp -Rf ${OUTPUT}/mingw64/include . +cp -Rf ${OUTPUT}/mingw64/lib lib-8.3.0/x64 +cp -Rf ${OUTPUT}/mingw32/lib lib-8.3.0/i386 +cp -Rf ${OUTPUT}/ucrt64/lib lib/x64 +ls -ltrRh . + +# Imagemagick config files +mkdir -p include-config/x64 include-config/i386 +cp -f ${OUTPUT}/ucrt64/include/ImageMagick-6/magick/magick-baseconfig.h include-config/x64/ +cp -f ${OUTPUT}/mingw32/include/ImageMagick-6/magick/magick-baseconfig.h include-config/i386/ diff --git a/.github/workflows/bundle.yml b/.github/workflows/bundle.yml new file mode 100644 index 0000000..0742b72 --- /dev/null +++ b/.github/workflows/bundle.yml @@ -0,0 +1,30 @@ +name: bundle binaries + +on: + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + steps: + - name: Prepare git + run: | + git config --global core.autocrlf false + git config --global user.email 'jeroenooms@gmail.com' + git config --global user.name 'Jeroen Ooms (via CI)' + - uses: actions/checkout@v3 + - uses: r-windows/install-rtools@master + - id: download + name: Download libraries + run: | + cd $(cygpath ${GITHUB_WORKSPACE}) + .github/workflows/bundle.sh + shell: c:\rtools40\usr\bin\bash.exe --login {0} + - name: Push binaries + run: | + version=${{ steps.download.outputs.VERSION }} + git add . + git commit -m "Bundle $version ($(date +%F))" || exit 0 + git tag $version + git push origin master $version + shell: bash