From e780e4b15869e4e31e1aff0bd46918a43d883434 Mon Sep 17 00:00:00 2001 From: Nick Vanden Eynde Date: Sun, 24 Jan 2021 00:58:19 +0100 Subject: [PATCH] Add github build script --- .github/workflows/build.yml | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..460685c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,70 @@ +name: Rust +on: [push] +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/Snake && mv target/release/Snake target/release/Snake_amd64 + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/release/Snake_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/Snake.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/Snake && mv target/release/Snake target/release/Snake_darwin + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/release/Snake_darwin + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}