chore: release v0.1.5 #7
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release CLI and PerchApp | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-macos: | |
| name: Build macOS CLI | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-apple-darwin | |
| swift_arch: arm64 | |
| - target: x86_64-apple-darwin | |
| swift_arch: x86_64 | |
| steps: | |
| - name: Validate release tag | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| if ! echo "${GITHUB_REF_NAME}" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then | |
| echo "Release tags must use semantic version format: vX.Y.Z" | |
| exit 1 | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Build perch CLI | |
| run: cargo build --release --manifest-path cli/Cargo.toml --target ${{ matrix.target }} | |
| - name: Package CLI binary | |
| run: | | |
| cp cli/target/${{ matrix.target }}/release/perch perch-${{ matrix.target }} | |
| shasum -a 256 perch-${{ matrix.target }} > perch-${{ matrix.target }}.sha256 | |
| - name: Build PerchApp | |
| run: swift build -c release --package-path App --arch ${{ matrix.swift_arch }} | |
| - name: Package PerchApp | |
| run: | | |
| APP_BIN=$(find App/.build -path '*/release/PerchApp' -type f | head -n 1) | |
| if [ -z "$APP_BIN" ]; then | |
| echo "Could not find built PerchApp executable" | |
| find App/.build -name PerchApp -type f -print | |
| exit 1 | |
| fi | |
| if ! "$APP_BIN" --version | grep -qi '^PerchApp '; then | |
| echo "Built executable did not identify as PerchApp" | |
| exit 1 | |
| fi | |
| RESOURCE_BUNDLE=$(find App/.build -path '*/release/PerchApp_PerchAppCore.bundle' -type d | head -n 1) | |
| if [ -z "$RESOURCE_BUNDLE" ]; then | |
| echo "Could not find PerchAppCore resource bundle" | |
| find App/.build -name 'PerchApp_PerchAppCore.bundle' -type d -print | |
| exit 1 | |
| fi | |
| rm -rf package-app | |
| mkdir -p package-app/Perch.app/Contents/MacOS package-app/Perch.app/Contents/Resources | |
| cp "$APP_BIN" package-app/Perch.app/Contents/MacOS/PerchApp | |
| cp -R "$RESOURCE_BUNDLE" package-app/Perch.app/PerchApp_PerchAppCore.bundle | |
| chmod +x package-app/Perch.app/Contents/MacOS/PerchApp | |
| cat > package-app/Perch.app/Contents/Info.plist <<'EOF' | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>CFBundleExecutable</key> | |
| <string>PerchApp</string> | |
| <key>CFBundleIdentifier</key> | |
| <string>com.resciencelab.perch</string> | |
| <key>CFBundleName</key> | |
| <string>Perch</string> | |
| <key>CFBundlePackageType</key> | |
| <string>APPL</string> | |
| <key>CFBundleShortVersionString</key> | |
| <string>0.1.5</string> | |
| <key>LSMinimumSystemVersion</key> | |
| <string>13.0</string> | |
| <key>LSUIElement</key> | |
| <true/> | |
| </dict> | |
| </plist> | |
| EOF | |
| (cd package-app && ditto -c -k --keepParent Perch.app ../PerchApp-${{ matrix.target }}.zip) | |
| shasum -a 256 PerchApp-${{ matrix.target }}.zip > PerchApp-${{ matrix.target }}.zip.sha256 | |
| - name: Upload workflow artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: perch-${{ matrix.target }} | |
| path: | | |
| perch-${{ matrix.target }} | |
| perch-${{ matrix.target }}.sha256 | |
| PerchApp-${{ matrix.target }}.zip | |
| PerchApp-${{ matrix.target }}.zip.sha256 | |
| - name: Upload release assets | |
| if: startsWith(github.ref, 'refs/tags/') | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1 || \ | |
| gh release create "${GITHUB_REF_NAME}" --title "${GITHUB_REF_NAME}" --generate-notes | |
| if ! gh release upload "${GITHUB_REF_NAME}" \ | |
| perch-${{ matrix.target }} \ | |
| perch-${{ matrix.target }}.sha256 \ | |
| PerchApp-${{ matrix.target }}.zip \ | |
| PerchApp-${{ matrix.target }}.zip.sha256 \ | |
| --clobber; then | |
| echo "Failed to upload release assets" | |
| exit 1 | |
| fi | |
| gh release view "${GITHUB_REF_NAME}" --json assets --jq '.assets[].name' |