@@ -2,44 +2,121 @@ name: Rust
2
2
3
3
on :
4
4
push :
5
- branches : [ main ]
6
5
paths :
7
6
- " Cargo.toml"
8
7
- " src/**"
9
8
- " devices/**"
10
9
- " !**.md"
10
+ - " .github/workflows/rust.yml"
11
11
pull_request :
12
12
branches : [ main ]
13
13
paths :
14
14
- " Cargo.toml"
15
15
- " src/**"
16
16
- " devices/**"
17
17
- " !**.md"
18
+ - " .github/workflows/rust.yml"
18
19
workflow_dispatch :
20
+ release :
21
+ types :
22
+ - created
23
+ schedule : # Every day at the 2 P.M. (UTC) we run a scheduled nightly build
24
+ - cron : " 0 14 * * *"
25
+
26
+ concurrency :
27
+ group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
28
+ cancel-in-progress : true
19
29
20
30
env :
21
31
CARGO_TERM_COLOR : always
22
32
23
33
jobs :
24
34
build :
25
- name : build (${{ matrix.config.os }})
35
+ name : build (${{ matrix.config.arch }})
26
36
strategy :
27
37
matrix :
28
38
config :
29
39
- os : windows-latest
40
+ arch : win-x64
30
41
- os : ubuntu-latest
42
+ arch : linux-x64
31
43
- os : macos-latest
44
+ arch : macos-arm64
45
+ - os : macos-12
46
+ arch : macos-x64
32
47
runs-on : ${{ matrix.config.os }}
33
48
34
49
steps :
35
- - uses : actions/checkout@v3
50
+ - uses : actions/checkout@v4
36
51
- name : Build
37
52
run : cargo build --release
38
53
- name : Run tests
39
54
run : cargo test
40
55
- name : Run help
41
56
run : cargo run -- --help
42
- - uses : actions/upload-artifact@v3
57
+
58
+ - name : Prepare artifacts
59
+ run : |
60
+ if [[ "${{ runner.os }}" == "Windows" ]]; then
61
+ WCHISP_EXE="wchisp.exe"
62
+ else
63
+ WCHISP_EXE="wchisp"
64
+ fi
65
+
66
+ mkdir wchisp-${{ matrix.config.arch }}
67
+ cp target/release/$WCHISP_EXE wchisp-${{ matrix.config.arch }}
68
+ cp README.md wchisp-${{ matrix.config.arch }}
69
+ shell : bash
70
+ - uses : actions/upload-artifact@v4
71
+ with :
72
+ name : wchisp-${{ matrix.config.arch }}
73
+ path : wchisp-${{ matrix.config.arch }}
74
+
75
+ - name : Prepare Release Asset
76
+ if : github.event_name == 'release'
77
+ run : |
78
+ if [[ "${{ runner.os }}" == "Windows" ]]; then
79
+ 7z a -tzip wchisp-${{ github.event.release.tag_name }}-${{ matrix.config.arch }}.zip wchisp-${{ matrix.config.arch }}
80
+ else
81
+ zip -r wchisp-${{ github.event.release.tag_name }}-${{ matrix.config.arch }}.zip wchisp-${{ matrix.config.arch }}
82
+ fi
83
+ shell : bash
84
+ - name : Upload Release Asset
85
+ uses : softprops/action-gh-release@v1
86
+ if : github.event_name == 'release'
43
87
with :
44
- name : wchisp-${{ matrix.config.os }}
45
- path : target/debug/wchisp*
88
+ files : |
89
+ wchisp-${{ github.event.release.tag_name }}-${{ matrix.config.arch }}.zip
90
+
91
+ nightly-release :
92
+ needs : build
93
+ runs-on : ubuntu-latest
94
+ if : github.event_name == 'schedule'
95
+ steps :
96
+ - name : Download Artifacts
97
+ uses : actions/download-artifact@v4
98
+ with :
99
+ path : ./
100
+
101
+ - name : Prepare Nightly Asset
102
+ run : |
103
+ ls -R ./
104
+ for f in wchisp-*; do
105
+ echo "Compressing $f with zip -r $f.zip $f"
106
+ zip -r $f.zip $f
107
+ done
108
+ ls ./
109
+
110
+ - name : Update Nightly Release
111
+ uses : andelf/nightly-release@main
112
+ env :
113
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
114
+ with :
115
+ tag_name : nightly
116
+ name : " wchisp nightly release $$"
117
+ draft : false
118
+ prerelease : true
119
+ body : |
120
+ This is a nightly binary release of the wchisp command line tool.
121
+ files : |
122
+ wchisp-*.zip
0 commit comments