Release v0.4.0 #13
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: build-release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| cache-dependency-path: gui/package-lock.json | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Checkout llm-sdk dependency | |
| shell: bash | |
| run: | | |
| git clone --depth 1 https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/brainless/llm-sdk.git "$GITHUB_WORKSPACE/../llm-sdk" | |
| - name: Build production artifacts | |
| shell: bash | |
| env: | |
| DWATA_DEFAULT_GOOGLE_CLIENT_ID: ${{ secrets.DWATA_GOOGLE_CLIENT_ID }} | |
| DWATA_DEFAULT_GOOGLE_CLIENT_SECRET: ${{ secrets.DWATA_GOOGLE_CLIENT_SECRET }} | |
| run: ./scripts/build-production.sh | |
| - name: Rename binary for release | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" = "Windows" ]; then | |
| mv target/release/dwata-api.exe target/release/dwata.exe | |
| else | |
| mv target/release/dwata-api target/release/dwata | |
| fi | |
| - name: Build static Linux binary (musl) | |
| if: startsWith(matrix.os, 'ubuntu') | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools musl-dev | |
| rustup target add x86_64-unknown-linux-musl | |
| cargo build --release --target x86_64-unknown-linux-musl -p dwata-api --features vendored-openssl | |
| mv target/x86_64-unknown-linux-musl/release/dwata-api target/x86_64-unknown-linux-musl/release/dwata | |
| - name: Install Linux packaging tools | |
| if: startsWith(matrix.os, 'ubuntu') | |
| shell: bash | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y rpm | |
| cargo install cargo-deb cargo-generate-rpm | |
| - name: Package Linux artifacts | |
| if: startsWith(matrix.os, 'ubuntu') | |
| shell: bash | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| BIN="target/release/dwata" | |
| MUSL_BIN="target/x86_64-unknown-linux-musl/release/dwata" | |
| # Regular dynamically linked binary | |
| tar -czf "dwata-${VERSION}-linux-x64.tar.gz" "$BIN" | |
| # Static musl binary (universal, works on any Linux distro) | |
| tar -czf "dwata-${VERSION}-linux-x64-static.tar.gz" "$MUSL_BIN" | |
| # Debian package | |
| cargo deb -p dwata-api --no-build --output "dwata-${VERSION}-linux-x64.deb" | |
| # RPM package | |
| cargo generate-rpm -p dwata-api --output "dwata-${VERSION}-linux-x64.rpm" | |
| - name: Install macOS packaging tools | |
| if: startsWith(matrix.os, 'macos') | |
| shell: bash | |
| run: | | |
| cargo install cargo-bundle | |
| - name: Package macOS artifacts | |
| if: startsWith(matrix.os, 'macos') | |
| shell: bash | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| BIN="target/release/dwata" | |
| # Create tar.gz (existing) | |
| tar -czf "dwata-${VERSION}-macos-x64.tar.gz" "$BIN" | |
| # Create DMG using cargo-bundle | |
| cargo bundle --release -p dwata-api | |
| # Find the generated DMG and rename it | |
| DMG_PATH=$(find target/release/bundle/osx -name "*.dmg" | head -n 1) | |
| if [ -n "$DMG_PATH" ]; then | |
| cp "$DMG_PATH" "dwata-${VERSION}-macos-x64.dmg" | |
| fi | |
| - name: Package Windows artifacts | |
| if: startsWith(matrix.os, 'windows') | |
| shell: bash | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| BIN="target/release/dwata.exe" | |
| 7z a "dwata-${VERSION}-windows-x64.zip" "$BIN" | |
| - name: Upload release artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dwata-${{ matrix.os }} | |
| path: | | |
| dwata-*.tar.gz | |
| dwata-*.zip | |
| dwata-*.deb | |
| dwata-*.rpm | |
| dwata-*.dmg | |
| - name: Attach artifacts to GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| dwata-*.tar.gz | |
| dwata-*.zip | |
| dwata-*.deb | |
| dwata-*.rpm | |
| dwata-*.dmg |