name: Release on: push: tags: - 'v*' workflow_dispatch: permissions: contents: write jobs: build-cli: name: Build CLI (${{ matrix.target }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: macos-latest target: aarch64-apple-darwin binary_name: nut artifact_name: nut-aarch64-apple-darwin.tar.gz - os: macos-latest target: x86_64-apple-darwin binary_name: nut artifact_name: nut-x86_64-apple-darwin.tar.gz - os: ubuntu-latest target: x86_64-unknown-linux-musl binary_name: nut artifact_name: nut-x86_64-unknown-linux-musl.tar.gz use_cross: true - os: ubuntu-latest target: aarch64-unknown-linux-musl binary_name: nut artifact_name: nut-aarch64-unknown-linux-musl.tar.gz use_cross: true - os: windows-latest target: x86_64-pc-windows-msvc binary_name: nut.exe artifact_name: nut-x86_64-pc-windows-msvc.zip steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Rust stable uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Setup Rust cache uses: Swatinem/rust-cache@v2 - name: Install cross if: matrix.use_cross run: cargo install cross --git https://github.com/cross-rs/cross - name: Build static CLI binary (with cross) if: matrix.use_cross run: cross build --release --target ${{ matrix.target }} -p nut - name: Build CLI binary (standard) if: "!matrix.use_cross" run: cargo build --release --target ${{ matrix.target }} -p nut - name: Package Unix binary if: runner.os != 'Windows' run: | mkdir -p staging cp target/${{ matrix.target }}/release/${{ matrix.binary_name }} staging/ cp README.md LICENSE staging/ tar -czf ${{ matrix.artifact_name }} -C staging . - name: Package Windows binary if: runner.os == 'Windows' shell: pwsh run: | New-Item -ItemType Directory -Force -Path staging Copy-Item target/${{ matrix.target }}/release/${{ matrix.binary_name }} staging/ Copy-Item README.md, LICENSE staging/ Compress-Archive -Path staging/* -DestinationPath ${{ matrix.artifact_name }} - name: Upload CLI Artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact_name }} path: ${{ matrix.artifact_name }} build-gui: name: Build GUI (${{ matrix.platform }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - platform: macOS os: macos-latest - platform: Linux os: ubuntu-latest - platform: Windows os: windows-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 - name: Install Rust stable uses: dtolnay/rust-toolchain@stable - name: Setup Rust cache uses: Swatinem/rust-cache@v2 - name: Install Linux dependencies if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev rpm - name: Install frontend dependencies working-directory: gui run: npm ci - name: Build Tauri GUI uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: projectPath: "./gui" tagName: ${{ github.ref_name }} releaseName: "Nextcloud Upload Tool ${{ github.ref_name }}" releaseBody: "See release notes for changes." releaseDraft: true prerelease: false publish-release: name: Publish Release & Checksums needs: [build-cli, build-gui] runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Download all CLI artifacts uses: actions/download-artifact@v4 with: path: artifacts - name: Generate Checksums run: | cd artifacts find . -type f -name "*.tar.gz" -o -name "*.zip" -exec sha256sum {} + > SHA256SUMS cat SHA256SUMS - name: Upload Checksums to GitHub Release if: startsWith(github.ref, 'refs/tags/v') uses: softprops/action-gh-release@v2 with: files: | artifacts/**/* artifacts/SHA256SUMS draft: false prerelease: false