| 
									
										
										
										
											2023-05-22 20:33:19 +00:00
										 |  |  | VERSION="${VERSION:-$(echo ${GITHUB_REF} | sed -e 's|refs/heads/||' -e 's|refs/tags/||' -e 's|/|-|g')}" | 
					
						
							| 
									
										
										
										
											2020-01-28 03:22:22 +00:00
										 |  |  | OS="${BUILD:-$(uname)}" | 
					
						
							| 
									
										
										
										
											2022-04-18 08:59:42 +00:00
										 |  |  | ARCH="$(uname -m)" | 
					
						
							| 
									
										
										
										
											2021-12-08 21:18:41 +00:00
										 |  |  | mkdir artifacts | 
					
						
							| 
									
										
										
										
											2022-02-28 15:30:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 01:55:26 +00:00
										 |  |  | if [ "$BUILD" = "osx" ]; then | 
					
						
							| 
									
										
										
										
											2024-05-01 17:34:25 +00:00
										 |  |  |     cp -a icons locales print LICENSE VERSION palettes symbols fonts tiles dbus inx dist/inkstitch.app/Contents/Resources | 
					
						
							| 
									
										
										
										
											2022-02-28 15:30:40 +00:00
										 |  |  |     # adding version to Info.plist | 
					
						
							| 
									
										
										
										
											2023-05-22 20:33:19 +00:00
										 |  |  |     plutil -replace CFBundleShortVersionString -string ${VERSION} dist/inkstitch.app/Contents/Info.plist | 
					
						
							| 
									
										
										
										
											2021-03-04 17:40:53 +00:00
										 |  |  |     rm -rf dist/inkstitch/ | 
					
						
							| 
									
										
										
										
											2022-04-18 08:59:42 +00:00
										 |  |  |     # Install location for pkgbuild | 
					
						
							|  |  |  |     PKG_INSTALL_PATH="/tmp/inkstitch/" | 
					
						
							| 
									
										
										
										
											2024-05-01 17:34:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-08 21:18:41 +00:00
										 |  |  |     # inside the scripts folder are: | 
					
						
							| 
									
										
										
										
											2022-04-18 08:59:42 +00:00
										 |  |  |     # - preinstaller (checks for previously installed inkstitch and deletes it, Inkscape check with error message) and | 
					
						
							| 
									
										
										
										
											2021-12-08 21:18:41 +00:00
										 |  |  |     # - postinstaller (moves inkstitch folder from /tmp to user Inkscape extensions folder in $HOME) | 
					
						
							|  |  |  |     # The postinstaller is a workaround for a proper way to install in user $HOME space | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Build on GitHub will be handled differently from local builds. | 
					
						
							|  |  |  |     # Local builds will not be signed nor notarized. They are run to produce releases for legacy versions of macOS. | 
					
						
							|  |  |  |     # Notarization for development branches can be forced with this variable set to true | 
					
						
							|  |  |  |     NOTARIZE_DEVELOPMENT_BUILDS=false | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if [[ ! -z "${GITHUB_REF}" ]]; then | 
					
						
							|  |  |  |         # This code signs and notarize the inkstitch.app | 
					
						
							|  |  |  |         DEV_IDENT="Developer ID Application: Lex Neva (929A568N58)" | 
					
						
							|  |  |  |         echo "Signing of inkstitch.app" | 
					
						
							|  |  |  |         # signing the binary may fix notary issue | 
					
						
							|  |  |  |         /usr/bin/codesign -s "${DEV_IDENT}" \ | 
					
						
							|  |  |  |                         --deep \ | 
					
						
							|  |  |  |                         --force \ | 
					
						
							|  |  |  |                         --entitlements installer_scripts/entitlements.plist \ | 
					
						
							|  |  |  |                         -o runtime \ | 
					
						
							|  |  |  |                         --timestamp \ | 
					
						
							|  |  |  |                         dist/inkstitch.app/Contents/MacOS/inkstitch -v | 
					
						
							|  |  |  |         # last signing before packaging | 
					
						
							|  |  |  |         /usr/bin/codesign -s "${DEV_IDENT}" \ | 
					
						
							|  |  |  |                         --deep \ | 
					
						
							|  |  |  |                         --force \ | 
					
						
							|  |  |  |                         --entitlements installer_scripts/entitlements.plist \ | 
					
						
							|  |  |  |                         -o runtime \ | 
					
						
							|  |  |  |                         --timestamp \ | 
					
						
							|  |  |  |                         dist/inkstitch.app -v | 
					
						
							|  |  |  |         echo "Running pkgbuild" | 
					
						
							|  |  |  |         INSTALLER_IDENT="Developer ID Installer: Lex Neva (929A568N58)" | 
					
						
							|  |  |  |         /usr/bin/pkgbuild --root dist/inkstitch.app \ | 
					
						
							|  |  |  |                         -s "${INSTALLER_IDENT}" \ | 
					
						
							|  |  |  |                         --ownership recommended \ | 
					
						
							|  |  |  |                         --identifier org.inkstitch.installer \ | 
					
						
							|  |  |  |                         --version ${VERSION} \ | 
					
						
							|  |  |  |                         --scripts installer_scripts/scripts \ | 
					
						
							| 
									
										
										
										
											2022-04-18 08:59:42 +00:00
										 |  |  |                         --install-location ${PKG_INSTALL_PATH}inkstitch.app \ | 
					
						
							| 
									
										
										
										
											2024-07-02 19:43:17 +00:00
										 |  |  |                         artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.pkg | 
					
						
							| 
									
										
										
										
											2021-12-08 21:18:41 +00:00
										 |  |  |         if [[ "${GITHUB_REF}" =~ ^refs/tags/v[0-9.]+$ || $NOTARIZE_DEVELOPMENT_BUILDS == true ]]; then | 
					
						
							|  |  |  |             echo "Notary starting" | 
					
						
							| 
									
										
										
										
											2023-04-27 17:51:05 +00:00
										 |  |  |             echo "Adding keychain item for notarytool" | 
					
						
							|  |  |  |             xcrun notarytool store-credentials "inkstitch-profile"  \ | 
					
						
							|  |  |  |                                                 --apple-id "${NOTARY_ACCOUNT}" \ | 
					
						
							|  |  |  |                                                 --team-id '929A568N58' \ | 
					
						
							|  |  |  |                                                 --password "${NOTARY_PASSWORD}" | 
					
						
							|  |  |  |             echo "Invoking notary process" | 
					
						
							| 
									
										
										
										
											2023-10-15 05:08:36 +00:00
										 |  |  |             xcrun notarytool submit -f json --wait \ | 
					
						
							| 
									
										
										
										
											2023-04-27 17:51:05 +00:00
										 |  |  |                                     --keychain-profile "inkstitch-profile" \ | 
					
						
							| 
									
										
										
										
											2024-07-02 19:43:17 +00:00
										 |  |  |                                     artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.pkg 2>&1 | tee /tmp/notarization_info.json | 
					
						
							| 
									
										
										
										
											2023-04-27 17:51:05 +00:00
										 |  |  |             echo "Stapling the pkg for release" | 
					
						
							| 
									
										
										
										
											2024-07-02 19:43:17 +00:00
										 |  |  |             xcrun stapler staple artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.pkg | 
					
						
							| 
									
										
										
										
											2023-10-15 05:08:36 +00:00
										 |  |  |             echo "Fetching the Notary Log" | 
					
						
							|  |  |  |             # code snippet is from https://github.com/ddev/signing_tools/blob/master/macos_notarize.sh | 
					
						
							|  |  |  |             status=$(jq -r .status </tmp/notarization_info.json) | 
					
						
							|  |  |  |             id=$(jq -r .id </tmp/notarization_info.json) | 
					
						
							|  |  |  |             echo "status=${status} id=${id}" | 
					
						
							|  |  |  |             xcrun notarytool log --apple-id "${NOTARY_ACCOUNT}" --team-id '929A568N58'  --password "${NOTARY_PASSWORD}" ${id} -f json >/tmp/notarization_log.json | 
					
						
							|  |  |  |             issues=$(jq -r .issues </tmp/notarization_log.json) | 
					
						
							|  |  |  |             if [ "$issues" != "null" ]; then | 
					
						
							|  |  |  |                 printf "There are issues with the notarization (${issues})\n" | 
					
						
							|  |  |  |                 printf "=== Log output === \n$(cat /tmp/notarization_log.json)\n" | 
					
						
							|  |  |  |                 exit 7; | 
					
						
							|  |  |  |             fi; | 
					
						
							| 
									
										
										
										
											2021-12-08 21:18:41 +00:00
										 |  |  |         fi | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |         # local builds will not be signed or notarized | 
					
						
							|  |  |  |         pkgbuild --root dist/inkstitch.app \ | 
					
						
							|  |  |  |                 --ownership recommended \ | 
					
						
							|  |  |  |                 --identifier org.inkstitch.installer \ | 
					
						
							|  |  |  |                 --version ${VERSION} \ | 
					
						
							|  |  |  |                 --scripts installer_scripts/scripts \ | 
					
						
							| 
									
										
										
										
											2022-04-18 08:59:42 +00:00
										 |  |  |                 --install-location ${PKG_INSTALL_PATH}inkstitch.app \ | 
					
						
							| 
									
										
										
										
											2024-07-02 19:43:17 +00:00
										 |  |  |                 artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.pkg | 
					
						
							| 
									
										
										
										
											2021-12-08 21:18:41 +00:00
										 |  |  |     fi | 
					
						
							| 
									
										
										
										
											2022-02-28 15:30:40 +00:00
										 |  |  |     # Creating the zip for Drag n' Drop install | 
					
						
							|  |  |  |     cd dist | 
					
						
							| 
									
										
										
										
											2024-07-02 19:43:17 +00:00
										 |  |  |     7z a ../artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.zip * | 
					
						
							| 
									
										
										
										
											2022-02-28 15:30:40 +00:00
										 |  |  |     cd .. | 
					
						
							| 
									
										
										
										
											2019-04-21 01:55:26 +00:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2024-07-02 19:43:17 +00:00
										 |  |  |     cp -a palettes symbols fonts tiles dbus inx LICENSE VERSION dist/inkstitch | 
					
						
							| 
									
										
										
										
											2021-03-04 17:40:53 +00:00
										 |  |  |     cp -a icons locales print dist/inkstitch/bin | 
					
						
							| 
									
										
										
										
											2019-04-21 01:55:26 +00:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-08 21:18:41 +00:00
										 |  |  | if [ "$BUILD" = "windows" ]; then | 
					
						
							|  |  |  |     # build the installer locally | 
					
						
							|  |  |  |     # remotely it will be called through build.yml after signing | 
					
						
							|  |  |  |     if [[ -z "${GITHUB_REF}" ]]; then | 
					
						
							|  |  |  |         bash bin/build-windows-installer | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2019-11-15 18:09:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-07 14:12:18 +00:00
										 |  |  | if [ "$BUILD" = "linux" ] || [ "$BUILD" = "linux-new" ] || [ "$BUILD" = "linux-old" ] || [ "$BUILD" = "linux32" ]; then | 
					
						
							| 
									
										
										
										
											2022-01-10 17:20:15 +00:00
										 |  |  |     if [[ "$VERSION" =~ ^v[0-9][.0-9]+$ ]]; then | 
					
						
							|  |  |  |         VERSION=${VERSION#v} | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |         # dpkg requires versions to start with a number, so we have to add | 
					
						
							|  |  |  |         # 0.0.1 for development builds | 
					
						
							|  |  |  |         VERSION="0.0.1-${VERSION}" | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo -n "$INKSTITCH_GPG_KEY" | base64 -d | gpg --import | 
					
						
							|  |  |  |     cat <<EOF > $HOME/.rpmmacros | 
					
						
							|  |  |  | %_gpg_name EA93BCE2CCD0FB2E77B2CC29E8120E50709E5C44 | 
					
						
							|  |  |  | %_signature gpg | 
					
						
							|  |  |  | EOF | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-05 01:13:22 +00:00
										 |  |  |     deb_version="$(sed -E 's/[^a-zA-Z0-9.+]/./g' <<< "$VERSION")" | 
					
						
							| 
									
										
										
										
											2022-01-10 17:20:15 +00:00
										 |  |  |     fpm -s dir \ | 
					
						
							|  |  |  |         -t deb \ | 
					
						
							|  |  |  |         -n inkstitch \ | 
					
						
							| 
									
										
										
										
											2022-04-05 01:13:22 +00:00
										 |  |  |         -v "$deb_version" \ | 
					
						
							| 
									
										
										
										
											2022-01-10 17:20:15 +00:00
										 |  |  |         -d "inkscape >= 1.0.0" \ | 
					
						
							| 
									
										
										
										
											2023-04-27 17:51:05 +00:00
										 |  |  |         --deb-compression xz \ | 
					
						
							| 
									
										
										
										
											2022-01-10 17:20:15 +00:00
										 |  |  |         --license "GPL-3.0" \ | 
					
						
							|  |  |  |         --description "An open-source machine embroidery design platform based on Inkscape" \ | 
					
						
							|  |  |  |         --url "https://inkstitch.org" \ | 
					
						
							|  |  |  |         --maintainer "maintainer@inkstitch.org" \ | 
					
						
							|  |  |  |         --after-install bin/after-install \ | 
					
						
							|  |  |  |         --before-remove bin/before-remove \ | 
					
						
							|  |  |  |         --verbose \ | 
					
						
							|  |  |  |         dist/inkstitch=/opt | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     fpm -s dir \ | 
					
						
							|  |  |  |         -t rpm \ | 
					
						
							|  |  |  |         -n inkstitch \ | 
					
						
							|  |  |  |         -v "$VERSION" \ | 
					
						
							|  |  |  |         -d "inkscape >= 1.0.0" \ | 
					
						
							| 
									
										
										
										
											2023-04-27 17:51:05 +00:00
										 |  |  |         --rpm-compression xz \ | 
					
						
							| 
									
										
										
										
											2022-01-10 17:20:15 +00:00
										 |  |  |         --license "GPL-3.0" \ | 
					
						
							|  |  |  |         --description "An open-source machine embroidery design platform based on Inkscape" \ | 
					
						
							|  |  |  |         --url "https://inkstitch.org"  \ | 
					
						
							|  |  |  |         --maintainer "maintainer@inkstitch.org" \ | 
					
						
							|  |  |  |         --after-install bin/after-install \ | 
					
						
							|  |  |  |         --before-remove bin/before-remove \ | 
					
						
							|  |  |  |         --verbose \ | 
					
						
							|  |  |  |         dist/inkstitch=/opt | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     rpmsign --addsign inkstitch*.rpm | 
					
						
							|  |  |  |     mv inkstitch*.deb inkstitch*.rpm artifacts/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     tar -C dist -Jcf artifacts/inkstitch-${VERSION}-${OS}.tar.xz inkstitch | 
					
						
							|  |  |  |     cat "$(dirname "$0")/linux-sh-installer" artifacts/inkstitch-${VERSION}-${OS}.tar.xz > artifacts/inkstitch-${VERSION}-${OS}.sh | 
					
						
							| 
									
										
										
										
											2021-09-26 09:42:17 +00:00
										 |  |  | fi |