fix(install): point install scripts at dbopt-* release assets #42
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 | |
| # Builds a single self-contained binary per OS and attaches the artifacts | |
| # to a GitHub Release. The backend embeds the web/dist/ bundle via | |
| # rust-embed, so each artifact is a true single-file deliverable. | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'release tag (e.g. v0.1.0)' | |
| required: true | |
| jobs: | |
| web: | |
| name: build web bundle | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: { node-version: '22' } | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: { targets: wasm32-unknown-unknown } | |
| - name: install wasm-pack | |
| run: curl -sSf https://rustwasm.github.io/wasm-pack/installer/init.sh | sh | |
| - name: build wasm analyzer | |
| run: wasm-pack build crates/analyzer-wasm --target web --out-dir ../../web/src/wasm --release | |
| - name: install web deps | |
| working-directory: web | |
| run: npm ci | |
| - name: build web | |
| working-directory: web | |
| run: npm run build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: web-dist | |
| path: web/dist/ | |
| retention-days: 1 | |
| binary: | |
| name: ${{ matrix.label }} | |
| needs: web | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { label: linux-x86_64, os: ubuntu-latest, target: x86_64-unknown-linux-gnu, archive: tar.gz, binsuffix: '' } | |
| - { label: macos-arm64, os: macos-latest, target: aarch64-apple-darwin, archive: tar.gz, binsuffix: '' } | |
| - { label: windows-x86_64, os: windows-latest, target: x86_64-pc-windows-msvc, archive: zip, binsuffix: '.exe' } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.target }} | |
| - name: fetch web bundle | |
| uses: actions/download-artifact@v4 | |
| with: { name: web-dist, path: web/dist } | |
| - name: build backend | |
| run: cargo build --release --target ${{ matrix.target }} -p backend | |
| - name: stage artifact | |
| shell: bash | |
| run: | | |
| mkdir -p staging | |
| cp target/${{ matrix.target }}/release/dbopt-backend${{ matrix.binsuffix }} staging/dbopt${{ matrix.binsuffix }} | |
| cp README.md staging/ 2>/dev/null || true | |
| cp samples/bad.sql staging/sample.sql 2>/dev/null || true | |
| - name: archive | |
| shell: bash | |
| run: | | |
| cd staging | |
| if [ "${{ matrix.archive }}" = "zip" ]; then | |
| 7z a ../dbopt-${{ matrix.label }}.zip ./* | |
| else | |
| tar czf ../dbopt-${{ matrix.label }}.tar.gz ./* | |
| fi | |
| - name: macos dmg | |
| if: startsWith(matrix.label, 'macos-') | |
| run: | | |
| VER="${{ github.event.inputs.tag || github.ref_name }}" | |
| VER="${VER#v}" # strip leading v from e.g. v0.2.0 | |
| VER="${VER:-0.0.0}" # fall back if somehow empty | |
| mkdir -p dbopt-${{ matrix.label }}-app/dbopt.app/Contents/MacOS | |
| cp staging/dbopt dbopt-${{ matrix.label }}-app/dbopt.app/Contents/MacOS/dbopt | |
| chmod +x dbopt-${{ matrix.label }}-app/dbopt.app/Contents/MacOS/dbopt | |
| cat > dbopt-${{ matrix.label }}-app/dbopt.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>dbopt</string> | |
| <key>CFBundleIdentifier</key><string>dev.dbopt.observatory</string> | |
| <key>CFBundleName</key><string>dbopt</string> | |
| <key>CFBundlePackageType</key><string>APPL</string> | |
| <key>CFBundleShortVersionString</key><string>${VER}</string> | |
| <key>CFBundleVersion</key><string>1</string> | |
| <key>NSHighResolutionCapable</key><true/> | |
| </dict></plist> | |
| EOF | |
| hdiutil create -volname dbopt -srcfolder dbopt-${{ matrix.label }}-app -ov -format UDZO dbopt-${{ matrix.label }}.dmg | |
| - name: windows MSI (best-effort) | |
| if: matrix.label == 'windows-x86_64' | |
| continue-on-error: true | |
| shell: pwsh | |
| run: | | |
| cargo install cargo-wix --locked | |
| cargo wix init -p backend --force | |
| cargo wix -p backend --no-build --target ${{ matrix.target }} --nocapture --output dbopt-windows-x86_64.msi | |
| - name: linux AppImage (best-effort) | |
| if: matrix.label == 'linux-x86_64' | |
| run: | | |
| mkdir -p dbopt.AppDir/usr/bin | |
| cp staging/dbopt dbopt.AppDir/usr/bin/dbopt | |
| chmod +x dbopt.AppDir/usr/bin/dbopt | |
| cat > dbopt.AppDir/dbopt.desktop <<EOF | |
| [Desktop Entry] | |
| Type=Application | |
| Name=dbopt | |
| Exec=dbopt | |
| Icon=dbopt | |
| Categories=Development;Database; | |
| Terminal=true | |
| EOF | |
| touch dbopt.AppDir/dbopt.png | |
| cat > dbopt.AppDir/AppRun <<'EOF' | |
| #!/bin/sh | |
| HERE="$(dirname "$(readlink -f "${0}")")" | |
| exec "${HERE}/usr/bin/dbopt" "$@" | |
| EOF | |
| chmod +x dbopt.AppDir/AppRun | |
| curl -L -o appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || true | |
| chmod +x appimagetool || true | |
| ARCH=x86_64 ./appimagetool dbopt.AppDir dbopt-linux-x86_64.AppImage || \ | |
| echo "AppImage build skipped (appimagetool unavailable)" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dbopt-${{ matrix.label }} | |
| path: | | |
| dbopt-${{ matrix.label }}.tar.gz | |
| dbopt-${{ matrix.label }}.zip | |
| dbopt-${{ matrix.label }}.dmg | |
| dbopt-windows-x86_64.msi | |
| dbopt-linux-x86_64.AppImage | |
| if-no-files-found: ignore | |
| release: | |
| name: publish release | |
| needs: binary | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: { path: artifacts } | |
| - name: stage flat | |
| run: | | |
| mkdir -p out | |
| find artifacts -type f \( -name '*.tar.gz' -o -name '*.zip' -o -name '*.dmg' -o -name '*.msi' -o -name '*.AppImage' \) -exec cp {} out/ \; | |
| (cd out && sha256sum * > SHA256SUMS) | |
| ls -la out | |
| - name: gh release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.tag || github.ref_name }} | |
| files: out/* | |
| generate_release_notes: true |