Release #9
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 | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: ./package-lock.json | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-darwin,x86_64-apple-darwin | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: . | |
| - name: Install frontend dependencies | |
| run: npm install | |
| - name: Create universal tiles-cli sidecar | |
| run: | | |
| lipo -create -output src-tauri/binaries/tiles-cli-universal-apple-darwin \ | |
| src-tauri/binaries/tiles-cli-aarch64-apple-darwin \ | |
| src-tauri/binaries/tiles-cli-x86_64-apple-darwin | |
| chmod +x src-tauri/binaries/tiles-cli-universal-apple-darwin | |
| - name: Build (app bundle only, no DMG) | |
| env: | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| run: npm run tauri -- build --target universal-apple-darwin --bundles app | |
| - name: Create DMG manually | |
| env: | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| VERSION="${TAG#v}" | |
| APP="$GITHUB_WORKSPACE/target/universal-apple-darwin/release/bundle/macos/tiles.app" | |
| DMG="/tmp/tiles_${VERSION}_universal.dmg" | |
| mkdir -p /tmp/dmg-staging | |
| cp -r "$APP" /tmp/dmg-staging/ | |
| ln -s /Applications /tmp/dmg-staging/Applications | |
| hdiutil create \ | |
| -volname "tiles" \ | |
| -srcfolder /tmp/dmg-staging \ | |
| -ov \ | |
| -format UDZO \ | |
| "$DMG" | |
| - name: Package and sign updater artifact | |
| env: | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| VERSION="${TAG#v}" | |
| MACOS="$GITHUB_WORKSPACE/target/universal-apple-darwin/release/bundle/macos" | |
| tar czf /tmp/tiles.app.tar.gz -C "$MACOS" tiles.app | |
| cp /tmp/tiles.app.tar.gz "$MACOS/tiles.app.tar.gz" | |
| npm run tauri -- signer sign \ | |
| --private-key "$TAURI_SIGNING_PRIVATE_KEY" \ | |
| --password "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" \ | |
| "$MACOS/tiles.app.tar.gz" | |
| - name: Create release and upload artifacts | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_PAT }} | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| VERSION="${TAG#v}" | |
| MACOS="$GITHUB_WORKSPACE/target/universal-apple-darwin/release/bundle/macos" | |
| gh release create "$TAG" \ | |
| --title "tiles $TAG" \ | |
| --notes "" \ | |
| --repo whaleen/tiles \ | |
| "/tmp/tiles_${VERSION}_universal.dmg" \ | |
| "$MACOS/tiles.app.tar.gz" \ | |
| "$MACOS/tiles.app.tar.gz.sig" | |
| - name: Update homebrew cask and tiles-latest.json | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_PAT }} | |
| TAG: ${{ github.ref_name }} | |
| run: | | |
| VERSION="${TAG#v}" | |
| MACOS="$GITHUB_WORKSPACE/target/universal-apple-darwin/release/bundle/macos" | |
| SIG_CONTENT=$(cat "$MACOS/tiles.app.tar.gz.sig") | |
| SHA256=$(shasum -a 256 "/tmp/tiles_${VERSION}_universal.dmg" | awk '{print $1}') | |
| RELEASE=$(gh api repos/whaleen/tiles/releases/tags/$TAG) | |
| URL=$(echo "$RELEASE" | jq -r '.assets[] | select(.name | endswith("app.tar.gz")) | .browser_download_url') | |
| PUB_DATE=$(echo "$RELEASE" | jq -r '.published_at') | |
| git clone https://x-access-token:$GH_TOKEN@github.com/whaleen/homebrew-tap.git /tmp/homebrew-tap | |
| cd /tmp/homebrew-tap | |
| jq -n \ | |
| --arg version "$VERSION" \ | |
| --arg pub_date "$PUB_DATE" \ | |
| --arg url "$URL" \ | |
| --arg sig "$SIG_CONTENT" \ | |
| '{ | |
| version: $version, | |
| pub_date: $pub_date, | |
| platforms: { | |
| "darwin-aarch64": { url: $url, signature: $sig }, | |
| "darwin-x86_64": { url: $url, signature: $sig } | |
| } | |
| }' > tiles-latest.json | |
| sed -i '' "s/version \".*\"/version \"${VERSION}\"/" Casks/tiles.rb | |
| sed -i '' "s/sha256 \".*\"/sha256 \"${SHA256}\"/" Casks/tiles.rb | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add tiles-latest.json Casks/tiles.rb | |
| git commit -m "update: tiles $TAG" | |
| git push |