-
-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (95 loc) · 3.1 KB
/
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Multi-OS Binary Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: demo
ext: ""
- os: windows-latest
target: x86_64-pc-windows-gnu
bin: demo
ext: ".exe"
- os: macos-latest
target: x86_64-apple-darwin
bin: demo
ext: ""
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.target }}
- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --bin ${{ matrix.bin }} --manifest-path demo/Cargo.toml --target ${{ matrix.target }}
- name: List workspace output
run: |
echo "Listing workspace root directory:"
if [ "${{ runner.os }}" = "Windows" ]; then
dir
else
ls -la
fi
echo "Listing general target directory:"
if [ "${{ runner.os }}" = "Windows" ]; then
dir "target/${{ matrix.target }}/release/"
else
ls -la "target/${{ matrix.target }}/release/"
fi
shell: bash
- name: Prepare assets
run: |
mkdir -p release/${{ matrix.bin }}
if [ -f "target/${{ matrix.target }}/release/${{ matrix.bin }}${{ matrix.ext }}" ]; then
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}${{ matrix.ext }}" "release/${{ matrix.bin }}/${{ matrix.bin }}${{ matrix.ext }}"
else
echo "Binary not found, check build settings and output."
exit 1
fi
shell: bash
- name: Zip assets
run: |
if ("${{ runner.os }}" -eq "Windows") {
Compress-Archive -Path "release/${{ matrix.bin }}/*" -DestinationPath "${{ matrix.bin }}-${{ matrix.os }}.zip"
} else {
zip -r "${{ matrix.bin }}-${{ matrix.os }}.zip" "release/${{ matrix.bin }}"
}
shell: pwsh
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.bin }}-${{ matrix.os }}
path: "${{ matrix.bin }}-${{ matrix.os }}.zip"
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.bin }}-${{ matrix.os }}
path: "release/${{ matrix.bin }}-${{ matrix.os }}.zip"
release:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
path: downloaded-artifacts
- name: Create Release
uses: ncipollo/[email protected]
with:
artifacts: "downloaded-artifacts/*/*.zip"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
owner: ${{ github.repository_owner }}
repo: butter2d