Bump version to v0.16.3 #62
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 Binaries | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Triggers on version tags like v0.7.0 | |
| workflow_dispatch: # Allows manual trigger from GitHub UI | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for the release' | |
| required: false | |
| default: 'manual-build' | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # macOS Apple Silicon | |
| - os: macos-14 | |
| target: aarch64-apple-darwin | |
| use_cross: false | |
| # Linux x86_64 (musl for static binaries - works on all distros) | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| use_cross: false | |
| # Windows x86_64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| use_cross: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install cross-compilation tool | |
| if: matrix.use_cross | |
| run: | | |
| cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Install musl tools (Linux musl) | |
| if: matrix.target == 'x86_64-unknown-linux-musl' && !matrix.use_cross | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Install OpenSSL for Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| vcpkg install openssl:x64-windows-static-md | |
| echo "OPENSSL_DIR=C:/vcpkg/installed/x64-windows-static-md" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "OPENSSL_ROOT_DIR=C:/vcpkg/installed/x64-windows-static-md" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "OPENSSL_INCLUDE_DIR=C:/vcpkg/installed/x64-windows-static-md/include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "OPENSSL_LIB_DIR=C:/vcpkg/installed/x64-windows-static-md/lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "VCPKG_ROOT=C:/vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Cache cargo registry | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-cargo-registry- | |
| - name: Cache cargo index | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-cargo-index- | |
| - name: Cache cargo build | |
| uses: actions/cache@v5 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-cargo-build- | |
| - name: Set binary extension | |
| id: binary_ext | |
| shell: bash | |
| run: | | |
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
| echo "ext=.exe" >> $GITHUB_OUTPUT | |
| else | |
| echo "ext=" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Install SQLx CLI | |
| run: cargo install sqlx-cli --no-default-features --features sqlite | |
| - name: Setup database | |
| run: | | |
| sqlx database setup --source torc-server/migrations | |
| env: | |
| DATABASE_URL: sqlite:db/sqlite/dev.db | |
| - name: Build binaries (with cross) | |
| if: matrix.use_cross | |
| run: | | |
| cross build --release --target ${{ matrix.target }} --workspace --all-features | |
| - name: Build binaries (native) | |
| if: "!matrix.use_cross" | |
| run: | | |
| cargo build --workspace --all-features --release --target ${{ matrix.target }} | |
| - name: Create release archive | |
| shell: bash | |
| run: | | |
| mkdir -p release | |
| cd target/${{ matrix.target }}/release | |
| # Determine archive name | |
| if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
| ARCHIVE_NAME="torc-${{ matrix.target }}.zip" | |
| 7z a ../../../release/$ARCHIVE_NAME torc.exe torc-server.exe torc-slurm-job-runner.exe torc-dash.exe torc-htpasswd.exe torc-mcp-server.exe | |
| else | |
| ARCHIVE_NAME="torc-${{ matrix.target }}.tar.gz" | |
| tar czf ../../../release/$ARCHIVE_NAME torc torc-server torc-slurm-job-runner torc-dash torc-htpasswd torc-mcp-server | |
| fi | |
| cd ../../../release | |
| ls -lh | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: torc-${{ matrix.target }} | |
| path: release/* | |
| retention-days: 7 | |
| publish-crate: | |
| name: Publish to crates.io | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Publish to crates.io | |
| run: cargo publish --locked | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| SQLX_OFFLINE: "true" | |
| create-release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -R artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| generate_release_notes: true | |
| files: | | |
| artifacts/torc-aarch64-apple-darwin/*.tar.gz | |
| artifacts/torc-x86_64-unknown-linux-musl/*.tar.gz | |
| artifacts/torc-x86_64-pc-windows-msvc/*.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| docker: | |
| name: Build and Push Docker Image | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Extract version and image name | |
| id: meta | |
| run: | | |
| echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT | |
| echo "image=ghcr.io/${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT | |
| - name: Download Linux musl artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: torc-x86_64-unknown-linux-musl | |
| path: artifact | |
| - name: Extract binaries for Docker build | |
| run: tar xzf artifact/torc-x86_64-unknown-linux-musl.tar.gz -C artifact/ | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| build-args: VERSION=${{ steps.meta.outputs.version }} | |
| tags: | | |
| ${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }} | |
| ${{ steps.meta.outputs.image }}:latest |