1+ name : Rust
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ pull_request :
7+ branches : [ "main" ]
8+ release :
9+ types : [published]
10+
11+ env :
12+ CARGO_TERM_COLOR : always
13+
14+ jobs :
15+ build-mac-win :
16+ name : Build for ${{ matrix.os }}
17+ strategy :
18+ matrix :
19+ os : [x86_64-apple-darwin, x86_64-pc-windows-gnu] # x86_64-unknown-linux-gnu]
20+
21+ runs-on : macos-latest
22+
23+ steps :
24+ - uses : actions/checkout@v3
25+
26+ - name : Add targets
27+ run : rustup target add ${{ matrix.os }}
28+
29+ - name : Install x86_64-w64-mingw32-gcc
30+ run : brew install mingw-w64
31+ if : matrix.os == 'x86_64-pc-windows-gnu'
32+ - name : Build for ${{ matrix.os }}
33+ uses : actions-rs/cargo@v1
34+ with :
35+ command : build
36+ args : --target ${{ matrix.os }} --release
37+
38+ - name : Move octool from target/${{ matrix.os }}/release/octool to .
39+ run : mv target/${{ matrix.os }}/release/octool.* .
40+
41+ - name : Create zip archive for ${{ matrix.os }} build
42+ run : zip ${{ matrix.os }}.zip octool octool.exe README.md LICENSE tool_config_files/octool_config.json
43+
44+ - name : " Upload to artifacts"
45+ if : always()
46+ uses : actions/upload-artifact@v3
47+ with :
48+ name : " ${{ matrix.os }}"
49+ path : " ${{ matrix.os }}.zip"
50+
51+ - name : Upload to Release
52+ if : github.event_name == 'release'
53+ uses : svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575
54+ with :
55+ repo_token : ${{ secrets.GITHUB_TOKEN }}
56+ file : output/*.zip
57+ tag : ${{ github.ref }}
58+ file_glob : true
59+
60+ build-linux :
61+ name : Build for x86_64-unknown-linux-gnu
62+ runs-on : ubuntu-latest
63+
64+ steps :
65+ - uses : actions/checkout@v3
66+
67+ - name : Add targets
68+ run : rustup target add x86_64-unknown-linux-gnu
69+
70+ - name : Build for x86_64-unknown-linux-gnu
71+ uses : actions-rs/cargo@v1
72+ with :
73+ command : build
74+ args : --target x86_64-unknown-linux-gnu --release
75+
76+ - name : Move octool from target/x86_64-unknown-linux-gnu/release/octool to .
77+ run : mv target/x86_64-unknown-linux-gnu/release/octool .
78+
79+ - name : Create zip archive for x86_64-unknown-linux-gnu build
80+ run : zip x86_64-unknown-linux-gnu.zip octool README.md LICENSE tool_config_files/octool_config.json
81+
82+ - name : " Upload to artifacts"
83+ if : always()
84+ uses : actions/upload-artifact@v3
85+ with :
86+ name : " x86_64-unknown-linux-gnu"
87+ path : " x86_64-unknown-linux-gnu.zip"
88+
89+ - name : Upload to Release
90+ if : github.event_name == 'release'
91+ uses : svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575
92+ with :
93+ repo_token : ${{ secrets.GITHUB_TOKEN }}
94+ file : output/*.zip
95+ tag : ${{ github.ref }}
96+ file_glob : true
0 commit comments