git.iko.soy/parseable-macos
on master help sign in
200 lines 6.5 kB history raw
1name: Build and Release
3on:
4 push:
5 branches: [master, main]
6 pull_request:
7 branches: [master, main]
9jobs:
10 build:
11 runs-on: macos-15
12 permissions:
13 id-token: write
14 attestations: write
15 contents: read
16 strategy:
17 matrix:
18 include:
19 - arch: arm64
20 sdk: macosx
21 - arch: x86_64
22 sdk: macosx
24 steps:
25 - name: Checkout
26 uses: actions/checkout@v4
28 - name: Select Xcode 16
29 run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
31 - name: Install XcodeGen
32 run: brew install xcodegen
34 - name: Generate Xcode project
35 run: xcodegen generate
37 - name: Run Tests
38 if: matrix.arch == 'arm64'
39 run: |
40 xcodebuild test \
41 -project ParseableViewer.xcodeproj \
42 -scheme ParseableViewer \
43 -configuration Debug \
44 -destination 'platform=macOS,arch=arm64' \
45 -derivedDataPath build \
46 CODE_SIGN_IDENTITY="-" \
47 CODE_SIGNING_REQUIRED=NO \
48 CODE_SIGNING_ALLOWED=NO
50 - name: Build
51 run: |
52 xcodebuild \
53 -project ParseableViewer.xcodeproj \
54 -scheme ParseableViewer \
55 -configuration Release \
56 -arch ${{ matrix.arch }} \
57 -derivedDataPath build \
58 CODE_SIGN_IDENTITY="-" \
59 CODE_SIGNING_REQUIRED=NO \
60 CODE_SIGNING_ALLOWED=NO \
61 build
63 - name: Package app
64 run: |
65 APP_PATH="build/Build/Products/Release/Parseable Viewer.app"
66 if [ -d "$APP_PATH" ]; then
67 cd build/Build/Products/Release
68 zip -r -y "ParseableViewer-${{ matrix.arch }}.zip" "Parseable Viewer.app"
69 mv "ParseableViewer-${{ matrix.arch }}.zip" "$GITHUB_WORKSPACE/"
70 else
71 echo "App not found at expected path, searching..."
72 find build -name "*.app" -type d
73 exit 1
74 fi
76 - name: Attest artifact
77 uses: actions/attest-build-provenance@v2
78 with:
79 subject-path: ParseableViewer-${{ matrix.arch }}.zip
81 - name: Upload artifact
82 uses: actions/upload-artifact@v4
83 with:
84 name: ParseableViewer-${{ matrix.arch }}
85 path: ParseableViewer-${{ matrix.arch }}.zip
87 create-universal:
88 needs: build
89 runs-on: macos-15
90 permissions:
91 id-token: write
92 attestations: write
93 contents: read
94 steps:
95 - name: Checkout
96 uses: actions/checkout@v4
98 - name: Download arm64 build
99 uses: actions/download-artifact@v4
100 with:
101 name: ParseableViewer-arm64
102 path: artifacts/arm64
104 - name: Download x86_64 build
105 uses: actions/download-artifact@v4
106 with:
107 name: ParseableViewer-x86_64
108 path: artifacts/x86_64
110 - name: Create Universal Binary
111 run: |
112 # Unzip both architectures
113 mkdir -p arm64_app x86_64_app universal_app
114 cd artifacts/arm64 && unzip ParseableViewer-arm64.zip -d ../../arm64_app && cd ../..
115 cd artifacts/x86_64 && unzip ParseableViewer-x86_64.zip -d ../../x86_64_app && cd ../..
117 # Copy the arm64 app as base
118 cp -R "arm64_app/Parseable Viewer.app" "universal_app/Parseable Viewer.app"
120 # Find the main executable name
121 EXEC_NAME="Parseable Viewer"
122 ARM64_EXEC="arm64_app/Parseable Viewer.app/Contents/MacOS/$EXEC_NAME"
123 X86_EXEC="x86_64_app/Parseable Viewer.app/Contents/MacOS/$EXEC_NAME"
124 UNIVERSAL_EXEC="universal_app/Parseable Viewer.app/Contents/MacOS/$EXEC_NAME"
126 if [ -f "$ARM64_EXEC" ] && [ -f "$X86_EXEC" ]; then
127 lipo -create "$ARM64_EXEC" "$X86_EXEC" -output "$UNIVERSAL_EXEC"
128 echo "Created universal binary"
129 lipo -info "$UNIVERSAL_EXEC"
130 else
131 echo "Error: Could not find executables for universal binary"
132 echo "arm64: $(ls -la arm64_app/Parseable\ Viewer.app/Contents/MacOS/ 2>/dev/null || echo 'not found')"
133 echo "x86_64: $(ls -la x86_64_app/Parseable\ Viewer.app/Contents/MacOS/ 2>/dev/null || echo 'not found')"
134 exit 1
135 fi
137 # Create zip
138 cd universal_app
139 zip -r -y "../ParseableViewer-universal.zip" "Parseable Viewer.app"
141 - name: Attest universal artifact
142 uses: actions/attest-build-provenance@v2
143 with:
144 subject-path: ParseableViewer-universal.zip
146 - name: Upload universal artifact
147 uses: actions/upload-artifact@v4
148 with:
149 name: ParseableViewer-universal
150 path: ParseableViewer-universal.zip
152 release:
153 needs: create-universal
154 runs-on: macos-15
155 concurrency:
156 group: release
157 cancel-in-progress: false
158 if: github.event_name == 'push'
159 permissions:
160 contents: write
161 id-token: write
162 attestations: write
163 steps:
164 - name: Checkout
165 uses: actions/checkout@v4
167 - name: Compute version from commit timestamp
168 id: version
169 run: |
170 COMMIT_TIMESTAMP=$(TZ=UTC git log -1 --format='%cd' --date=format-local:'%Y.%m.%d.%H%M')
171 echo "timestamp=$COMMIT_TIMESTAMP" >> "$GITHUB_OUTPUT"
173 - name: Download all artifacts
174 uses: actions/download-artifact@v4
175 with:
176 path: artifacts
178 - name: Attest release artifacts
179 uses: actions/attest-build-provenance@v2
180 with:
181 subject-path: |
182 artifacts/ParseableViewer-arm64/ParseableViewer-arm64.zip
183 artifacts/ParseableViewer-x86_64/ParseableViewer-x86_64.zip
184 artifacts/ParseableViewer-universal/ParseableViewer-universal.zip
186 - name: Create release
187 uses: softprops/action-gh-release@v2
188 with:
189 tag_name: ${{ steps.version.outputs.timestamp }}
190 name: ${{ steps.version.outputs.timestamp }}
191 body: |
192 **Branch:** ${{ github.ref_name }}
193 **Commit:** [`${{ github.sha }}`](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})
194 files: |
195 artifacts/ParseableViewer-arm64/ParseableViewer-arm64.zip
196 artifacts/ParseableViewer-x86_64/ParseableViewer-x86_64.zip
197 artifacts/ParseableViewer-universal/ParseableViewer-universal.zip
198 env:
199 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}