Brings over the functionality in https://github.com/FreeCAD/FreeCAD-Bundle to build Linux AppImage, macOS .dmg, and Windows 7z releases. This version also creates a tagged release for each build, creating an archive of the weekly builds as well as the ability to easily tie each build to a git commit. This will make running 'git bisect' easy to identify sources of regressions.
86 lines
2.8 KiB
Bash
Executable File
86 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
set -x
|
|
|
|
conda_env="AppDir/usr"
|
|
|
|
mkdir -p ${conda_env}
|
|
|
|
cp -a ../.pixi/envs/default/* ${conda_env}
|
|
|
|
export PATH="${PWD}/${conda_env}/bin:${PATH}"
|
|
export CONDA_PREFIX="${PWD}/${conda_env}"
|
|
|
|
echo -e "\nDelete unnecessary stuff"
|
|
rm -rf ${conda_env}/include
|
|
find ${conda_env} -name \*.a -delete
|
|
|
|
mv ${conda_env}/bin ${conda_env}/bin_tmp
|
|
mkdir ${conda_env}/bin
|
|
cp ${conda_env}/bin_tmp/freecad ${conda_env}/bin/
|
|
cp ${conda_env}/bin_tmp/freecadcmd ${conda_env}/bin
|
|
cp ${conda_env}/bin_tmp/ccx ${conda_env}/bin/
|
|
cp ${conda_env}/bin_tmp/python ${conda_env}/bin/
|
|
cp ${conda_env}/bin_tmp/pip ${conda_env}/bin/
|
|
cp ${conda_env}/bin_tmp/pyside6-rcc ${conda_env}/bin/
|
|
cp ${conda_env}/bin_tmp/gmsh ${conda_env}/bin/
|
|
cp ${conda_env}/bin_tmp/dot ${conda_env}/bin/
|
|
cp ${conda_env}/bin_tmp/unflatten ${conda_env}/bin/
|
|
rm -rf ${conda_env}/bin_tmp
|
|
|
|
sed -i '1s|.*|#!/usr/bin/env python|' ${conda_env}/bin/pip
|
|
|
|
echo -e "\nCopying Icon and Desktop file"
|
|
cp ${conda_env}/share/applications/org.freecad.FreeCAD.desktop AppDir/
|
|
sed -i 's/Exec=FreeCAD/Exec=AppRun/g' AppDir/org.freecad.FreeCAD.desktop
|
|
cp ${conda_env}/share/icons/hicolor/scalable/apps/org.freecad.FreeCAD.svg AppDir/
|
|
|
|
# Remove __pycache__ folders and .pyc files
|
|
find . -path "*/__pycache__/*" -delete
|
|
find . -name "*.pyc" -type f -delete
|
|
|
|
# reduce size
|
|
rm -rf ${conda_env}/conda-meta/
|
|
rm -rf ${conda_env}/doc/global/
|
|
rm -rf ${conda_env}/share/gtk-doc/
|
|
rm -rf ${conda_env}/lib/cmake/
|
|
|
|
find . -name "*.h" -type f -delete
|
|
find . -name "*.cmake" -type f -delete
|
|
|
|
build_tag=$(git describe --tags)
|
|
python_version=$(python -c 'import platform; print("py" + platform.python_version_tuple()[0] + platform.python_version_tuple()[1])')
|
|
version_name="FreeCAD_${build_tag}-Linux-$(uname -m)-${python_version}"
|
|
|
|
echo -e "\################"
|
|
echo -e "version_name: ${version_name}"
|
|
echo -e "################"
|
|
|
|
pixi list -e default > AppDir/packages.txt
|
|
sed -i "1s/.*/\nLIST OF PACKAGES:/" AppDir/packages.txt
|
|
|
|
export tag="weekly-builds" # should retreive from git tag
|
|
|
|
curl -LO https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage
|
|
chmod a+x appimagetool-$(uname -m).AppImage
|
|
|
|
echo -e "\nCreate the appimage"
|
|
# export GPG_TTY=$(tty)
|
|
chmod a+x ./AppDir/AppRun
|
|
./appimagetool-$(uname -m).AppImage \
|
|
--comp zstd \
|
|
--mksquashfs-opt -Xcompression-level \
|
|
--mksquashfs-opt 22 \
|
|
-u "gh-releases-zsync|FreeCAD|FreeCAD-Bundle|$tag|FreeCAD*$(uname -m)*.AppImage.zsync" \
|
|
AppDir ${version_name}.AppImage
|
|
# -s --sign-key ${GPG_KEY_ID} \
|
|
|
|
echo -e "\nCreate hash"
|
|
sha256sum ${version_name}.AppImage > ${version_name}.AppImage-SHA256.txt
|
|
|
|
if [ "${UPLOAD_RELEASE}" == "true" ]; then
|
|
gh release create ${BUILD_TAG} --title "Weekly Build ${BUILD_TAG}" --notes "Weekly Build ${BUILD_TAG}" --prerelease || true
|
|
gh release upload --clobber ${BUILD_TAG} "${version_name}.AppImage" "${version_name}.AppImage-SHA256.txt"
|
|
fi
|