-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (81 loc) · 2.57 KB
/
cli-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: cli-ci
on:
push:
branches: [ main ]
tags:
- '*'
pull_request:
branches: [ main ]
permissions:
contents: write
jobs:
build:
name: 'build ${{ matrix.target }}'
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# TODO: Implement https://github.com/doseiai/dosei/issues/62
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1
- name: Install ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Release
run: cargo build --package dosei --target ${{ matrix.target }} --release
- name: Zip (Linux/MacOS)
if: matrix.os != 'windows-latest'
run: zip -j dosei-${{ matrix.target }}.zip target/${{ matrix.target }}/release/dosei
- name: Zip (Windows)
if: matrix.os == 'windows-latest'
run: Compress-Archive -CompressionLevel Optimal -Force -Path target/${{ matrix.target }}/release/dosei.exe -DestinationPath dosei-${{ matrix.target }}.zip
- name: Upload Zip
uses: actions/upload-artifact@v4
with:
name: dosei-${{ matrix.target }}
path: dosei-${{ matrix.target }}.zip
release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
steps:
- uses: actions/download-artifact@v4
with:
pattern: dosei-*
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
dosei-x86_64-unknown-linux-gnu.zip
dosei-x86_64-apple-darwin.zip
dosei-aarch64-apple-darwin.zip
dosei-x86_64-pc-windows-msvc.zip
- name: Print files sha256
run: |
shasum -a 256 \
dosei-x86_64-unknown-linux-gnu.zip \
dosei-x86_64-apple-darwin.zip \
dosei-aarch64-apple-darwin.zip \
dosei-x86_64-pc-windows-msvc.zip