From 223b6bf872be64bf227383ac1a42bd88db6a96fc Mon Sep 17 00:00:00 2001 From: Katie And <56773311+Lilith-In-Starlight@users.noreply.github.com> Date: Sun, 14 Jan 2024 20:26:05 +0000 Subject: [PATCH] Create rust.yml --- .github/workflows/rust.yml | 85 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..a826e8c --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,85 @@ +name: Rust + +on: + push: + branches: + - 'releases/**' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + override: true + + - name: Build + run: cargo build --all --release && strip target/release/PROJECT_NAME && mv target/release/PROJECT_NAME target/release/PROJECT_NAME_amd64 + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/release/PROJECT_NAME_amd64 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-win: + runs-on: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + override: true + + - name: Build + run: cargo build --all --release + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: target/release/PROJECT_NAME.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-mac: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Install latest rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-apple-darwin + default: true + override: true + + - name: Build for mac + run: cargo build --all --release && strip target/release/PROJECT_NAME && mv target/release/PROJECT_NAME target/release/PROJECT_NAME_darwin + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/release/PROJECT_NAME_darwin + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}