Build and Release Binaries #14
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 and Release Binaries | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tagName: | |
| description: Tag name for new release | |
| required: true | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| SQLX_OFFLINE: true | |
| jobs: | |
| build: | |
| name: Build Release Binaries for ${{ github.event.inputs.tagName }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Check for main branch | |
| if: github.ref != 'refs/heads/main' | |
| run: | | |
| echo "This workflow can only be run on the main branch - ${{ github.ref }}" | |
| exit 1 | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: 1.89.0 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pkg-config libssl-dev | |
| - name: Build release binaries | |
| env: | |
| SQLX_OFFLINE: true | |
| run: ./tools/build_release.sh | |
| - name: Prepare artifacts | |
| run: | | |
| mkdir -p artifacts | |
| cp target/release/daemon-client artifacts/ | |
| cp target/release/api-client artifacts/ | |
| cp target/release/oracle artifacts/ | |
| chmod +x artifacts/daemon-client | |
| chmod +x artifacts/api-client | |
| chmod +x artifacts/oracle | |
| ls -la artifacts/ | |
| file artifacts/* | |
| - name: Create GitHub Release and Upload Binaries | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG=${{ github.event.inputs.tagName }} | |
| echo "TAG=$TAG" | |
| # Create release | |
| gh release create "${TAG}" \ | |
| --title "Release ${TAG}" \ | |
| --generate-notes \ | |
| --latest \ | |
| artifacts/daemon-client \ | |
| artifacts/api-client \ | |
| artifacts/oracle | |