|
1 |
| -name: Rust |
| 1 | +name: Build binary |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
5 |
| - branches: [ master ] |
| 5 | + tags: |
| 6 | + - v** |
6 | 7 | pull_request:
|
7 |
| - branches: [ master ] |
8 |
| - |
9 |
| -env: |
10 |
| - CARGO_TERM_COLOR: always |
11 | 8 |
|
12 | 9 | jobs:
|
13 |
| - "build-ubuntu-x64": |
14 |
| - runs-on: ubuntu-latest |
15 |
| - steps: |
16 |
| - - uses: actions/checkout@v2 |
17 |
| - - name: Install sqlite |
18 |
| - run: sudo apt install libsqlite3-dev |
19 |
| - - name: Install libssl |
20 |
| - run: sudo apt install libssl-dev |
21 |
| - - name: Build |
22 |
| - run: cargo build --release |
23 |
| -# - name: Compress the output |
24 |
| -# uses: crazy-max/[email protected] |
25 |
| -# with: |
26 |
| -# args: "--ultra-brute" |
27 |
| -# file: "target/release/app" |
28 |
| - - name: Upload |
29 |
| - |
30 |
| - with: |
31 |
| - name: "ubuntu-x86_64" |
32 |
| - path: "target/release/app" |
33 |
| - |
34 |
| - "build-windows-x64": |
35 |
| - runs-on: windows-latest |
36 |
| - steps: |
37 |
| - - uses: actions/checkout@v2 |
38 |
| - - name: Build |
39 |
| - run: cargo build --release |
40 |
| - - name: Compress the output |
41 |
| - |
42 |
| - with: |
43 |
| - args: "--ultra-brute" |
44 |
| - files: | |
45 |
| - "target/release/app.exe" |
46 |
| - - name: Upload |
47 |
| - |
48 |
| - with: |
49 |
| - name: "windows-x86_64" |
50 |
| - path: "target/release/app.exe" |
51 |
| - "build-macos-x64": |
52 |
| - runs-on: macos-latest |
| 10 | + build: |
| 11 | + strategy: |
| 12 | + fail-fast: true |
| 13 | + matrix: |
| 14 | + job: |
| 15 | + - { os: macos-latest } |
| 16 | + - { os: ubuntu-latest } |
| 17 | + - { os: windows-latest } |
| 18 | + |
| 19 | + |
| 20 | + name: Build |
| 21 | + runs-on: ${{ matrix.job.os }} |
53 | 22 | steps:
|
54 |
| - - uses: actions/checkout@v2 |
55 |
| - - name: Build |
56 |
| - run: cargo build --release |
57 |
| -# - name: Compress the output |
58 |
| -# uses: crazy-max/[email protected] |
59 |
| -# with: |
60 |
| -# args: "--ultra-brute" |
61 |
| -# file: "target/release/app" |
62 |
| - - name: Upload |
63 |
| - |
64 |
| - with: |
65 |
| - name: "macos-x86_64" |
66 |
| - path: "target/release/app" |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + - uses: actions-rs/toolchain@v1 |
| 25 | + with: |
| 26 | + profile: minimal |
| 27 | + toolchain: stable |
| 28 | + override: true |
| 29 | + - uses: actions-rs/cargo@v1 |
| 30 | + with: |
| 31 | + command: build |
| 32 | + args: --release |
| 33 | + - name: Rename binary |
| 34 | + id: rename |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + if [ "$RUNNER_OS" == "Linux" ]; then |
| 38 | + BIN='countdown_bot3_linux_amd64' |
| 39 | + mv target/release/app target/release/$BIN |
| 40 | + elif [ "$RUNNER_OS" == "macOS" ]; then |
| 41 | + BIN='countdown_bot3_darwin_amd64' |
| 42 | + mv target/release/app target/release/$BIN |
| 43 | + else |
| 44 | + BIN='countdown_bot3_windows_amd64.exe' |
| 45 | + mv target/release/app.exe target/release/$BIN |
| 46 | + fi |
| 47 | + echo "::set-output name=bin::target/release/$BIN" |
| 48 | + - uses: actions/upload-artifact@v2 |
| 49 | + with: |
| 50 | + name: artifact |
| 51 | + path: | |
| 52 | + target/release/countdown_bot3* |
| 53 | + - name: Release |
| 54 | + uses: softprops/action-gh-release@v1 |
| 55 | + if: startsWith(github.ref, 'refs/tags/') |
| 56 | + with: |
| 57 | + files: ${{ steps.rename.outputs.bin }} |
| 58 | + env: |
| 59 | + GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN }} |
0 commit comments