|
| 1 | +name: Release GUI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*-gui' # Trigger on tags like v1.0.2-gui |
| 7 | + workflow_dispatch: # Allow manual trigger |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Version number (e.g., 1.0.2)' |
| 11 | + required: true |
| 12 | + default: '1.0.2' |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + |
| 17 | +jobs: |
| 18 | + # Backend tests (Go) - must pass before building |
| 19 | + test-backend: |
| 20 | + name: Backend Tests |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Set up Go |
| 26 | + uses: actions/setup-go@v5 |
| 27 | + with: |
| 28 | + go-version: '1.21' |
| 29 | + |
| 30 | + - name: Create dummy frontend directory |
| 31 | + run: mkdir -p frontend/dist && echo "Test build" > frontend/dist/README.txt |
| 32 | + |
| 33 | + - name: Build |
| 34 | + run: go build -v ./cmd/... ./internal/... ./pkg/... |
| 35 | + |
| 36 | + - name: Test |
| 37 | + run: go test -v ./cmd/... ./internal/... ./pkg/... |
| 38 | + |
| 39 | + # Build macOS App - only after backend tests pass |
| 40 | + # Frontend tests run locally via pre-push hook |
| 41 | + build-macos: |
| 42 | + name: Build macOS App |
| 43 | + runs-on: macos-latest |
| 44 | + needs: [test-backend] |
| 45 | + steps: |
| 46 | + - name: Checkout |
| 47 | + uses: actions/checkout@v4 |
| 48 | + |
| 49 | + - name: Set up Go |
| 50 | + uses: actions/setup-go@v5 |
| 51 | + with: |
| 52 | + go-version: '1.21' |
| 53 | + |
| 54 | + - name: Setup Node.js |
| 55 | + uses: actions/setup-node@v4 |
| 56 | + with: |
| 57 | + node-version: '20' |
| 58 | + |
| 59 | + - name: Install Wails CLI |
| 60 | + run: go install github.com/wailsapp/wails/v2/cmd/wails@latest |
| 61 | + |
| 62 | + - name: Install frontend dependencies |
| 63 | + working-directory: ./frontend |
| 64 | + run: npm install |
| 65 | + |
| 66 | + - name: Build Wails App (macOS ARM64) |
| 67 | + run: | |
| 68 | + ~/go/bin/wails build -platform darwin/arm64 |
| 69 | + mv "build/bin/Mac Dev Cleaner.app" "build/bin/Mac Dev Cleaner-arm64.app" |
| 70 | + echo "✅ Built ARM64 app" |
| 71 | +
|
| 72 | + - name: Build Wails App (macOS AMD64) |
| 73 | + run: | |
| 74 | + ~/go/bin/wails build -platform darwin/amd64 |
| 75 | + mv "build/bin/Mac Dev Cleaner.app" "build/bin/Mac Dev Cleaner-amd64.app" |
| 76 | + echo "✅ Built AMD64 app" |
| 77 | +
|
| 78 | + - name: Get version |
| 79 | + id: version |
| 80 | + run: | |
| 81 | + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then |
| 82 | + echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT |
| 83 | + else |
| 84 | + # Extract version from tag (v1.0.2-gui -> 1.0.2) |
| 85 | + VERSION=$(echo "${GITHUB_REF#refs/tags/v}" | sed 's/-gui$//') |
| 86 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 87 | + fi |
| 88 | +
|
| 89 | + - name: Create DMG (ARM64) |
| 90 | + run: | |
| 91 | + cd build/bin |
| 92 | + # Rename to clean app name for DMG |
| 93 | + mv "Mac Dev Cleaner-arm64.app" "Mac Dev Cleaner.app" |
| 94 | + hdiutil create \ |
| 95 | + -volname "Mac Dev Cleaner" \ |
| 96 | + -srcfolder "Mac Dev Cleaner.app" \ |
| 97 | + -ov -format UDZO \ |
| 98 | + "Mac-Dev-Cleaner-${{ steps.version.outputs.version }}-arm64.dmg" |
| 99 | + # Restore original name for next build |
| 100 | + mv "Mac Dev Cleaner.app" "Mac Dev Cleaner-arm64.app" |
| 101 | + echo "✅ Created ARM64 DMG" |
| 102 | +
|
| 103 | + - name: Create DMG (AMD64) |
| 104 | + run: | |
| 105 | + cd build/bin |
| 106 | + # Rename to clean app name for DMG |
| 107 | + mv "Mac Dev Cleaner-amd64.app" "Mac Dev Cleaner.app" |
| 108 | + hdiutil create \ |
| 109 | + -volname "Mac Dev Cleaner" \ |
| 110 | + -srcfolder "Mac Dev Cleaner.app" \ |
| 111 | + -ov -format UDZO \ |
| 112 | + "Mac-Dev-Cleaner-${{ steps.version.outputs.version }}-amd64.dmg" |
| 113 | + echo "✅ Created AMD64 DMG" |
| 114 | +
|
| 115 | + - name: List build artifacts |
| 116 | + run: | |
| 117 | + ls -la build/bin/ |
| 118 | + ls -la build/bin/*.dmg || true |
| 119 | +
|
| 120 | + - name: Upload DMG artifacts |
| 121 | + uses: actions/upload-artifact@v4 |
| 122 | + with: |
| 123 | + name: macos-dmg |
| 124 | + path: build/bin/*.dmg |
| 125 | + retention-days: 7 |
| 126 | + |
| 127 | + - name: Create GitHub Release |
| 128 | + if: startsWith(github.ref, 'refs/tags/') |
| 129 | + uses: softprops/action-gh-release@v1 |
| 130 | + with: |
| 131 | + name: "Mac Dev Cleaner GUI v${{ steps.version.outputs.version }}" |
| 132 | + body: | |
| 133 | + ## Mac Dev Cleaner GUI v${{ steps.version.outputs.version }} |
| 134 | + |
| 135 | + ### Downloads |
| 136 | + - **Apple Silicon (M1/M2/M3)**: `Mac-Dev-Cleaner-${{ steps.version.outputs.version }}-arm64.dmg` |
| 137 | + - **Intel Mac**: `Mac-Dev-Cleaner-${{ steps.version.outputs.version }}-amd64.dmg` |
| 138 | + |
| 139 | + ### Installation |
| 140 | + 1. Download the appropriate DMG for your Mac |
| 141 | + 2. Open the DMG file |
| 142 | + 3. Drag "Mac Dev Cleaner" to Applications folder |
| 143 | + 4. Launch from Applications |
| 144 | + |
| 145 | + ### Note |
| 146 | + On first launch, you may need to right-click and select "Open" to bypass Gatekeeper. |
| 147 | + files: | |
| 148 | + build/bin/*.dmg |
| 149 | + draft: false |
| 150 | + prerelease: false |
| 151 | + env: |
| 152 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments