-
Notifications
You must be signed in to change notification settings - Fork 7
81 lines (81 loc) · 2.55 KB
/
create-draft-release.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
name: Create new draft release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
build:
name: Build release binaries
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
package: spreet-x86_64-unknown-linux-musl.tar.gz
- target: arm-unknown-linux-gnueabihf
os: ubuntu-latest
package: spreet-arm-unknown-linux-gnueabihf.tar.gz
- target: x86_64-apple-darwin
os: macos-latest
package: spreet-x86_64-apple-darwin.tar.gz
- target: aarch64-apple-darwin
os: macos-latest
package: spreet-aarch64-apple-darwin.tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
package: spreet-x86_64-pc-windows-msvc.zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install Cross
run: cargo install cross
- name: Build Spreet
run: cross build --release --locked --target ${{ matrix.target }}
- name: Prepare Windows package
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../${{ matrix.package }} spreet.exe
cd -
- name: Prepare Unix package
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar czvf ../../../${{ matrix.package }} spreet
cd -
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package }}
path: ${{ matrix.package }}
publish:
name: Publish draft release
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- id: version
name: Get version number
run: |
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./bin
- name: Create draft release
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.version.outputs.version }}
draft: true
generate_release_notes: true
files: |
./bin/**/*.zip
./bin/**/*.tar.gz