-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile.yml
More file actions
156 lines (144 loc) · 5.44 KB
/
Taskfile.yml
File metadata and controls
156 lines (144 loc) · 5.44 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
version: '3'
vars:
APP_NAME: OpenRouterCreditMenuBar
BUNDLE_ID: com.kttizz.OpenRouterCreditMenuBar
VERSION: v1.0.1
BUILD_DIR: ~/Library/Developer/Xcode/DerivedData
SCHEME: '{{.APP_NAME}}'
GITHUB_REPOSITORY: kittizz/OpenRouterCreditMenuBar
tasks:
clean:
desc: Clean build artifacts
cmds:
- rm -rf ./build
- rm -rf ./release
- rm -rf ~/Library/Developer/Xcode/DerivedData/OpenRouterCreditMenuBar-*
- rm -rf ./OpenRouterCreditMenuBar.xcodeproj/project.xcworkspace/xcuserdata
- rm -rf ./OpenRouterCreditMenuBar.xcodeproj/xcuserdata
- rm -rf ~/Library/Developer/Xcode/DerivedData/*
- sleep 2
- echo "Cleaned build artifacts"
build:
desc: Build Release version
deps: [clean]
cmds:
- |
if pgrep -x "Xcode" > /dev/null; then
echo "Xcode is running. Please close Xcode first."
exit 1
fi
- rm -rf ./build
- mkdir -p ./build
- |
xcodebuild -scheme {{.SCHEME}} \
-configuration Release \
-derivedDataPath ./build \
-destination "platform=macOS,arch=arm64" \
clean build
build-universal:
desc: Build Universal app (arm64 + x86_64)
deps: [clean]
cmds:
- rm -rf ./build
- mkdir -p ./build
- |
xcodebuild -scheme {{.SCHEME}} \
-configuration Release \
-derivedDataPath ./build \
-destination "platform=macOS,arch=arm64" \
-archivePath ./build/{{.APP_NAME}}-arm64.xcarchive \
archive
- |
xcodebuild -scheme {{.SCHEME}} \
-configuration Release \
-derivedDataPath ./build \
-destination "platform=macOS,arch=x86_64" \
-archivePath ./build/{{.APP_NAME}}-x86_64.xcarchive \
archive
- |
xcodebuild -create-xcframework \
-framework ./build/{{.APP_NAME}}-arm64.xcarchive/Products/Applications/{{.APP_NAME}}.app \
-framework ./build/{{.APP_NAME}}-x86_64.xcarchive/Products/Applications/{{.APP_NAME}}.app \
-output ./build/{{.APP_NAME}}.xcframework
export-app:
desc: Export Application from build
cmds:
- |
if [ ! -d "./build/Build/Products/Release/{{.APP_NAME}}.app" ]; then
echo "Build not found. Running build first..."
task build
fi
- mkdir -p ./release
- cp -R "./build/Build/Products/Release/{{.APP_NAME}}.app" "./release/"
- echo "Exported {{.APP_NAME}}.app to ./release/"
generates:
- ./release/{{.APP_NAME}}.app
create-dmg:
desc: Create DMG distribution package
deps: [export-app]
vars:
DMG_NAME: '{{.APP_NAME}}_{{.VERSION}}.dmg'
cmds:
- rm -f ./release/{{.DMG_NAME}}
- hdiutil create -volname "{{.APP_NAME}}" -srcfolder "./release/{{.APP_NAME}}.app" -ov -format UDZO "./release/{{.DMG_NAME}}"
- echo "Created DMG{{":"}} ./release/{{.DMG_NAME}}"
generates:
- ./release/{{.APP_NAME}}_{{.VERSION}}.dmg
create-zip:
desc: Create ZIP distribution package
deps: [export-app]
vars:
ZIP_NAME: '{{.APP_NAME}}_{{.VERSION}}.zip'
cmds:
- cd ./release && zip -r {{.ZIP_NAME}} {{.APP_NAME}}.app
- echo "Created ZIP{{":"}} ./release/{{.ZIP_NAME}}"
generates:
- ./release/{{.APP_NAME}}_{{.VERSION}}.zip
package:
desc: Create both DMG and ZIP packages
deps: [create-dmg, create-zip]
github-release:
desc: Create GitHub release and upload assets
deps: [package]
vars:
REPO: '{{.GITHUB_REPOSITORY}}'
cmds:
- |
gh release create {{.VERSION}} \
--title "{{.APP_NAME}} {{.VERSION}}" \
--notes "Release {{.VERSION}}" \
--repo {{.REPO}}
- |
gh release upload {{.VERSION}} \
./release/{{.APP_NAME}}_{{.VERSION}}.dmg \
./release/{{.APP_NAME}}_{{.VERSION}}.zip \
--repo {{.REPO}}
- echo "Released {{.VERSION}} to GitHub!"
release:
deps: [build]
desc: Full release pipeline
cmds:
- task: github-release
check-deps:
desc: Check required dependencies
cmds:
- |
if ! command -v gh &> /dev/null; then
echo "GitHub CLI not found. Install{{":"}} brew install gh"
exit 1
fi
- |
if ! gh auth status &> /dev/null; then
echo "Not authenticated with GitHub. Run{{":"}} gh auth login"
exit 1
fi
- echo "All dependencies satisfied"
debug-info:
desc: Show debug information
cmds:
- echo "Xcode version:"
- xcodebuild -version
- echo "Available schemes:"
- xcodebuild -list
- echo "Available destinations:"
- xcodebuild -showdestinations -scheme {{.SCHEME}}