1+ name : Deploy
2+
3+ on :
4+ push :
5+ tags :
6+ - " v[0-9]+.[0-9]+.[0-9]+"
7+
8+ env :
9+ CARGO_TERM_COLOR : always
10+
11+ permissions :
12+ contents : write
13+
14+ jobs :
15+ build-and-upload :
16+ name : Build and upload
17+ runs-on : ${{ matrix.os }}
18+
19+ strategy :
20+ matrix :
21+ # You can add more, for any target you'd like!
22+ include :
23+ # - build: linux
24+ # os: ubuntu-latest
25+ # target: x86_64-unknown-linux-musl
26+ #
27+ # - build: macos
28+ # os: macos-latest
29+ # target: x86_64-apple-darwin
30+
31+ - build : windows-gnu
32+ os : windows-latest
33+ target : x86_64-pc-windows-msvc
34+
35+ steps :
36+ - name : Checkout
37+ uses : actions/checkout@v3
38+
39+ - name : Get the release version from the tag
40+ shell : bash
41+ run : echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
42+
43+ - name : Install Rust
44+ # Or @nightly if you want
45+ uses : dtolnay/rust-toolchain@stable
46+ # Arguments to pass in
47+ with :
48+ # Make Rust compile to our target (defined in the matrix)
49+ targets : ${{ matrix.target }}
50+
51+ - name : Build
52+ run : cargo install cross; cross build -r --target ${{ matrix.target }} --bin=phoenix_gui
53+
54+ - name : Build archive
55+ shell : bash
56+ run : |
57+ # Replace with the name of your binary
58+ binary_name="phoenix_gui"
59+
60+ dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
61+ mkdir "$dirname"
62+ if [ "${{ matrix.os }}" = "windows-latest" ]; then
63+ mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
64+ else
65+ mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
66+ fi
67+
68+ if [ "${{ matrix.os }}" = "windows-latest" ]; then
69+ 7z a "$dirname.zip" "$dirname"
70+ echo "ASSET=$dirname.zip" >> $GITHUB_ENV
71+ else
72+ tar -czf "$dirname.tar.gz" "$dirname"
73+ echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
74+ fi
75+
76+ - name : Release
77+ uses : softprops/action-gh-release@v1
78+ with :
79+ files : |
80+ ${{ env.ASSET }}
0 commit comments