-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·94 lines (74 loc) · 2.19 KB
/
release.sh
File metadata and controls
executable file
·94 lines (74 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
set -euo pipefail
# Release script for SlayNode
# Builds local release artifacts that match the GitHub packaging flow
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${ROOT_DIR}"
usage() {
cat <<USAGE
usage: ./release.sh [version]
Examples:
./release.sh
./release.sh 1.0.3
USAGE
}
require_cmd() {
command -v "$1" >/dev/null 2>&1 || {
echo "❌ Missing command: $1" >&2
exit 1
}
}
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
usage
exit 0
fi
if [[ $# -gt 1 ]]; then
echo "❌ Too many arguments." >&2
usage >&2
exit 2
fi
for cmd in swift ditto hdiutil /usr/libexec/PlistBuddy; do
require_cmd "$cmd"
done
INFO_PLIST="${ROOT_DIR}/XcodeSupport/Info.plist"
VERSION_DEFAULT="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "${INFO_PLIST}")"
VERSION="${1:-${VERSION_DEFAULT}}"
if ! [[ "${VERSION}" =~ ^[0-9]+(\.[0-9]+){1,2}$ ]]; then
echo "❌ Invalid version: ${VERSION}" >&2
exit 2
fi
APP_NAME="SlayNode"
ZIP_NAME="${APP_NAME}-v${VERSION}.zip"
DMG_TEMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/slaynode-dmg.XXXXXX")"
cleanup() {
rm -rf "${DMG_TEMP_DIR}"
}
trap cleanup EXIT
echo "🚀 Creating SlayNode release v${VERSION}..."
# Build the app
echo "🔨 Building release version..."
SLAYNODE_VERSION="${VERSION}" ./build.sh release
if [[ -f "${ZIP_NAME}" ]]; then
rm "${ZIP_NAME}"
fi
echo "📦 Creating ZIP archive..."
ditto -c -k --keepParent "${APP_NAME}.app" "${ZIP_NAME}"
# Create DMG file
DMG_NAME="${APP_NAME}-v${VERSION}.dmg"
echo "📦 Creating DMG disk image..."
if [[ -f "${DMG_NAME}" ]]; then
rm "${DMG_NAME}"
fi
mkdir -p "${DMG_TEMP_DIR}/${APP_NAME}"
cp -R "${APP_NAME}.app" "${DMG_TEMP_DIR}/${APP_NAME}/"
ln -s /Applications "${DMG_TEMP_DIR}/Applications"
# Create DMG
hdiutil create -volname "${APP_NAME}" -srcfolder "${DMG_TEMP_DIR}" -ov -format UDZO "${DMG_NAME}"
echo "✅ Release ready: ${DMG_NAME}"
echo "✅ Release ready: ${ZIP_NAME}"
echo ""
echo "📋 To publish this version through GitHub Actions:"
echo "1. Commit your changes"
echo "2. Push to main"
echo "3. CI will validate the commit"
echo "4. The release workflow will create a build-numbered GitHub release for v${VERSION}"