diff options
author | Akshay <[email protected]> | 2020-07-22 17:33:14 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-07-22 17:33:14 +0100 |
commit | c421750d739f008902822a0254ccdff93556dca6 (patch) | |
tree | f612c76fbd945aeccf1c091e929648447c55b864 /.github/workflows | |
parent | 23e85aab0571f9c7214532a18a490ba6b6573f0e (diff) |
add action automatically release binaries on tag
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/main.yml | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..c8ccbae --- /dev/null +++ b/.github/workflows/main.yml | |||
@@ -0,0 +1,84 @@ | |||
1 | name: Rust | ||
2 | |||
3 | on: | ||
4 | push: | ||
5 | tags: | ||
6 | - '*' | ||
7 | |||
8 | jobs: | ||
9 | rustfmt: | ||
10 | runs-on: ubuntu-latest | ||
11 | steps: | ||
12 | - uses: actions/checkout@v1 | ||
13 | - run: rustup component add rustfmt | ||
14 | - run: cargo fmt -- --check | ||
15 | |||
16 | build-linux: | ||
17 | runs-on: ubuntu-latest | ||
18 | |||
19 | steps: | ||
20 | - name: Checkout | ||
21 | uses: actions/checkout@v1 | ||
22 | # cache the build assets so they dont recompile every time. | ||
23 | - name: Cache Rust dependencies | ||
24 | uses: actions/[email protected] | ||
25 | with: | ||
26 | path: target | ||
27 | key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
28 | restore-keys: | | ||
29 | ${{ runner.OS }}-build- | ||
30 | - name: Install latest rust toolchain | ||
31 | uses: actions-rs/toolchain@v1 | ||
32 | with: | ||
33 | toolchain: beta | ||
34 | default: true | ||
35 | override: true | ||
36 | - name: Install system dependencies | ||
37 | run: | | ||
38 | sudo apt-get update \ | ||
39 | && sudo apt-get install -y \ | ||
40 | libdbus-1-dev | ||
41 | - name: Build | ||
42 | run: cargo build --all --release && strip target/release/dijo | ||
43 | |||
44 | - name: Upload binaries to release | ||
45 | uses: svenstaro/upload-release-action@v1-release | ||
46 | with: | ||
47 | repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
48 | file: target/release/dijo | ||
49 | asset_name: dijo-x86_64-linux | ||
50 | tag: ${{ github.ref }} | ||
51 | overwrite: true | ||
52 | |||
53 | build-apple: | ||
54 | runs-on: macos-latest | ||
55 | |||
56 | steps: | ||
57 | - name: Checkout | ||
58 | uses: actions/checkout@v1 | ||
59 | - name: Cache Rust dependencies | ||
60 | uses: actions/[email protected] | ||
61 | with: | ||
62 | path: target | ||
63 | key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
64 | restore-keys: | | ||
65 | ${{ runner.OS }}-build- | ||
66 | - name: Install latest rust toolchain | ||
67 | uses: actions-rs/toolchain@v1 | ||
68 | with: | ||
69 | toolchain: beta | ||
70 | target: x86_64-apple-darwin | ||
71 | default: true | ||
72 | override: true | ||
73 | |||
74 | - name: Build for mac | ||
75 | run: cargo build --all --release && strip target/release/dijo | ||
76 | |||
77 | - name: Upload binaries to release | ||
78 | uses: svenstaro/upload-release-action@v1-release | ||
79 | with: | ||
80 | repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
81 | file: target/release/dijo | ||
82 | asset_name: dijo-x86_64-apple | ||
83 | tag: ${{ github.ref }} | ||
84 | overwrite: true | ||