Skip to content

Commit b19f471

Browse files
authored
Merge pull request #46 from zero-ide/feature/ci-cd-workflows
feature/ci-cd-workflows | GitHub Actions CI/CD 설정
2 parents 6e5738f + 836b5ef commit b19f471

3 files changed

Lines changed: 188 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: macos-14
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Swift
18+
uses: swift-actions/setup-swift@v1
19+
with:
20+
swift-version: '5.9'
21+
22+
- name: Cache Swift packages
23+
uses: actions/cache@v3
24+
with:
25+
path: .build
26+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
27+
restore-keys: |
28+
${{ runner.os }}-spm-
29+
30+
- name: Build
31+
run: swift build
32+
33+
- name: Run tests
34+
run: swift test
35+
36+
- name: Build release
37+
run: swift build -c release
38+
39+
- name: Upload build artifacts
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: Zero-app
43+
path: .build/release/Zero
44+
retention-days: 7

.github/workflows/release.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: macos-14
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Swift
17+
uses: swift-actions/setup-swift@v1
18+
with:
19+
swift-version: '5.9'
20+
21+
- name: Get version
22+
id: get_version
23+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
24+
25+
- name: Build release
26+
run: swift build -c release
27+
28+
- name: Create app bundle
29+
run: |
30+
VERSION=${{ steps.get_version.outputs.VERSION }}
31+
APP_NAME="Zero"
32+
BUILD_DIR=".build/release"
33+
RELEASE_DIR="releases"
34+
35+
mkdir -p ${RELEASE_DIR}
36+
37+
# Create app bundle
38+
APP_BUNDLE="${RELEASE_DIR}/${APP_NAME}.app"
39+
mkdir -p "${APP_BUNDLE}/Contents/MacOS"
40+
mkdir -p "${APP_BUNDLE}/Contents/Resources"
41+
42+
# Copy executable
43+
cp "${BUILD_DIR}/${APP_NAME}" "${APP_BUNDLE}/Contents/MacOS/"
44+
45+
# Copy resources
46+
cp -R "Sources/Zero/Resources/" "${APP_BUNDLE}/Contents/Resources/" || true
47+
48+
# Generate Info.plist
49+
cat > "${APP_BUNDLE}/Contents/Info.plist" << EOF
50+
<?xml version="1.0" encoding="UTF-8"?>
51+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
52+
<plist version="1.0">
53+
<dict>
54+
<key>CFBundleDevelopmentRegion</key>
55+
<string>en</string>
56+
<key>CFBundleExecutable</key>
57+
<string>${APP_NAME}</string>
58+
<key>CFBundleIdentifier</key>
59+
<string>com.zero.ide</string>
60+
<key>CFBundleInfoDictionaryVersion</key>
61+
<string>6.0</string>
62+
<key>CFBundleName</key>
63+
<string>${APP_NAME}</string>
64+
<key>CFBundlePackageType</key>
65+
<string>APPL</string>
66+
<key>CFBundleShortVersionString</key>
67+
<string>${VERSION}</string>
68+
<key>CFBundleVersion</key>
69+
<string>1</string>
70+
<key>LSMinimumSystemVersion</key>
71+
<string>14.0</string>
72+
<key>NSHighResolutionCapable</key>
73+
<true/>
74+
</dict>
75+
</plist>
76+
EOF
77+
78+
# Sign app (ad-hoc)
79+
codesign --force --deep --sign - "${APP_BUNDLE}" 2>/dev/null || true
80+
81+
# Create DMG
82+
DMG_TEMP=$(mktemp -d)
83+
cp -R "${APP_BUNDLE}" "${DMG_TEMP}/"
84+
ln -s /Applications "${DMG_TEMP}/Applications"
85+
86+
hdiutil create \
87+
-volname "${APP_NAME} ${VERSION}" \
88+
-srcfolder "${DMG_TEMP}" \
89+
-ov \
90+
-format UDZO \
91+
"${RELEASE_DIR}/${APP_NAME}-${VERSION}.dmg"
92+
93+
rm -rf "${DMG_TEMP}"
94+
95+
# Generate checksum
96+
cd ${RELEASE_DIR}
97+
shasum -a 256 "${APP_NAME}-${VERSION}.dmg" > "${APP_NAME}-${VERSION}.dmg.sha256"
98+
99+
- name: Create Release
100+
uses: softprops/action-gh-release@v1
101+
with:
102+
files: |
103+
releases/Zero-*.dmg
104+
releases/Zero-*.dmg.sha256
105+
draft: true
106+
prerelease: false
107+
generate_release_notes: true
108+
env:
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

scripts/release.sh

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mkdir -p "${APP_BUNDLE}/Contents/Resources"
3434
cp "${BUILD_DIR}/${APP_NAME}" "${APP_BUNDLE}/Contents/MacOS/"
3535

3636
# Copy resources
37-
cp -R "Sources/Zero/Resources/" "${APP_BUNDLE}/Contents/Resources/"
37+
cp -R "Sources/Zero/Resources/" "${APP_BUNDLE}/Contents/Resources/" || true
3838

3939
# Step 4: Generate Info.plist
4040
echo "📝 Generating Info.plist..."
@@ -48,7 +48,7 @@ cat > "${APP_BUNDLE}/Contents/Info.plist" << EOF
4848
<key>CFBundleExecutable</key>
4949
<string>${APP_NAME}</string>
5050
<key>CFBundleIconFile</key>
51-
<string>AppIcon</string>
51+
<string>logo</string>
5252
<key>CFBundleIdentifier</key>
5353
<string>com.zero.ide</string>
5454
<key>CFBundleInfoDictionaryVersion</key>
@@ -69,20 +69,20 @@ cat > "${APP_BUNDLE}/Contents/Info.plist" << EOF
6969
</plist>
7070
EOF
7171

72-
# Step 5: Generate icon (if script exists)
73-
if [ -f "scripts/generate-icons.sh" ]; then
74-
echo "🎨 Generating app icons..."
75-
bash scripts/generate-icons.sh
76-
fi
77-
78-
# Step 6: Sign the app (if certificate is available)
79-
if security find-identity -v -p codesigning | grep -q "Developer ID"; then
80-
echo "🔏 Signing app..."
81-
codesign --force --deep --sign "Developer ID Application" "${APP_BUNDLE}"
72+
# Step 5: Code signing (if available, otherwise ad-hoc sign)
73+
echo "🔏 Signing app..."
74+
if security find-identity -v -p codesigning 2>/dev/null | grep -q "Developer ID"; then
75+
codesign --force --deep --sign "Developer ID Application" "${APP_BUNDLE}" 2>/dev/null || \
76+
codesign --force --deep --sign - "${APP_BUNDLE}"
8277
else
83-
echo "⚠️ No Developer ID certificate found. Skipping code signing."
78+
echo "⚠️ Using ad-hoc signing (no Developer ID certificate)"
79+
codesign --force --deep --sign - "${APP_BUNDLE}" 2>/dev/null || true
8480
fi
8581

82+
# Step 6: Verify signature
83+
echo "✅ Verifying signature..."
84+
codesign -v "${APP_BUNDLE}" 2>/dev/null || echo "⚠️ Signature verification skipped"
85+
8686
# Step 7: Create DMG
8787
echo "💿 Creating DMG..."
8888

@@ -99,7 +99,11 @@ hdiutil create \
9999
-srcfolder "${DMG_TEMP}" \
100100
-ov \
101101
-format UDZO \
102-
"${RELEASE_DIR}/${DMG_NAME}"
102+
"${RELEASE_DIR}/${DMG_NAME}" || {
103+
echo "❌ DMG creation failed"
104+
rm -rf "${DMG_TEMP}"
105+
exit 1
106+
}
103107

104108
# Clean up temp directory
105109
rm -rf "${DMG_TEMP}"
@@ -116,26 +120,31 @@ cat > "${RELEASE_DIR}/RELEASE_NOTES.md" << EOF
116120
# Zero ${VERSION}
117121
118122
## What's New
119-
-
120-
121-
## Improvements
122-
-
123-
124-
## Bug Fixes
125-
-
123+
- Initial release of Zero IDE
124+
- Docker-based development environment
125+
- GitHub integration
126+
- Git operations (commit, branch, push, pull)
127+
- Java support with Maven/Gradle
126128
127129
## Download
128130
- [${DMG_NAME}](https://github.com/ori0o0p/Zero/releases/download/v${VERSION}/${DMG_NAME})
129131
- SHA256: \`$(cat ${RELEASE_DIR}/${DMG_NAME}.sha256 | cut -d ' ' -f 1)\`
130132
131133
## Requirements
132134
- macOS 14.0 or later
133-
- Docker Desktop
135+
- Docker Desktop installed and running
134136
135137
## Installation
136138
1. Download the DMG file
137139
2. Open the DMG and drag Zero to Applications
138140
3. Launch Zero from Applications
141+
4. On first launch, allow Zero in System Preferences > Security & Privacy
142+
143+
## Known Issues
144+
-
145+
146+
## Feedback
147+
Please report issues at: https://github.com/ori0o0p/Zero/issues
139148
EOF
140149

141150
echo ""
@@ -145,7 +154,8 @@ echo "📦 Files in ${RELEASE_DIR}/:"
145154
ls -lh ${RELEASE_DIR}/
146155
echo ""
147156
echo "📝 Next steps:"
148-
echo " 1. Review ${RELEASE_DIR}/RELEASE_NOTES.md"
149-
echo " 2. Create a new release on GitHub"
150-
echo " 3. Upload ${RELEASE_DIR}/${DMG_NAME}"
157+
echo " 1. Test the app: open ${RELEASE_DIR}/${APP_NAME}.app"
158+
echo " 2. Review ${RELEASE_DIR}/RELEASE_NOTES.md"
159+
echo " 3. Create a new release on GitHub: https://github.com/ori0o0p/Zero/releases/new"
160+
echo " 4. Upload ${RELEASE_DIR}/${DMG_NAME}"
151161
echo ""

0 commit comments

Comments
 (0)