Project Builder #36
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
| # It takes a lot of time | |
| # to build the binary on every run, | |
| # hence, I am making this workflow | |
| # to create a binary only when | |
| # a complete new change has been made. | |
| # NOTE: I am not adding "on push" because | |
| # a push on main can contain breaking changes. | |
| name: Project Builder | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| create_rust_binary: | |
| runs-on: ubuntu-latest | |
| # Got to know this from: https://github.com/marketplace/actions/setup-git-config | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Rust installation | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: adding musl tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Install musl target | |
| run: rustup target add x86_64-unknown-linux-musl | |
| - name: Build static binary | |
| env: | |
| RUSTFLAGS: -C target-feature=+crt-static | |
| run: | | |
| cargo build --release --target x86_64-unknown-linux-musl --bin cron-codeberg | |
| cargo build --release --target x86_64-unknown-linux-musl --bin cron-github | |
| cargo build --release --target x86_64-unknown-linux-musl --bin index-safe-repos | |
| - name: Upload binary | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release upload executables target/x86_64-unknown-linux-musl/release/cron-codeberg --clobber | |
| gh release upload executables target/x86_64-unknown-linux-musl/release/cron-github --clobber | |
| gh release upload executables target/x86_64-unknown-linux-musl/release/index-safe-repos --clobber |