-
Notifications
You must be signed in to change notification settings - Fork 22
138 lines (135 loc) · 4.74 KB
/
build.yaml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Build
on:
push:
jobs:
linux:
runs-on: ubuntu-20.04
steps:
- uses: hecrj/setup-rust-action@v1
- uses: actions/checkout@v2
- name: Install dependencies
run: |
set -x
sudo apt update
sudo apt install -y libasound2-dev
# fpm for creating DEB and RPM packages
sudo apt-get install -y ruby ruby-dev rubygems build-essential rpm libarchive-tools zstd
sudo gem install --no-document fpm
- name: Build binary
run: |
cargo build --verbose --release
mv target/release/eslauncher2 eslauncher2-x86_64-unknown-linux-gnu
- name: Strip binary
run: strip eslauncher2-x86_64-unknown-linux-gnu
- name: Build RPM and DEB
if: ${{ !startsWith(github.ref, 'refs/heads/dependabot') }}
run: |
version=${{github.ref}}
version="${version#refs/tags/v}"
# set dev version if not tag release
if ! grep '\([0-9]\+\.\)\{2\}[0-9]\+$' <<< "${version}"; then
version=0.0."$(date +%s)"
fi
./packaging/create-packages.sh "${version}"
mv *.deb eslauncher2.deb
mv *.rpm eslauncher2.rpm
mv *.pkg.tar.zst eslauncher2.pkg.tar.zst
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: eslauncher2-x86_64-unknown-linux-gnu
path: eslauncher2-x86_64-unknown-linux-gnu
- name: Upload DEB
if: ${{ !startsWith(github.ref, 'refs/heads/dependabot') }}
uses: actions/upload-artifact@v3
with:
name: eslauncher2.deb
path: eslauncher2.deb
- name: Upload RPM
if: ${{ !startsWith(github.ref, 'refs/heads/dependabot') }}
uses: actions/upload-artifact@v3
with:
name: eslauncher2.rpm
path: eslauncher2.rpm
- name: Upload ArchLinux package
if: ${{ !startsWith(github.ref, 'refs/heads/dependabot') }}
uses: actions/upload-artifact@v3
with:
name: eslauncher2.pkg.tar.zst
path: eslauncher2.pkg.tar.zst
- name: Release binary
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
eslauncher2-x86_64-unknown-linux-gnu
*.deb
*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows:
runs-on: windows-latest
steps:
- uses: hecrj/setup-rust-action@v1
- uses: actions/checkout@v2
- name: Enable static CRT linkage
run: |
mkdir .cargo
echo '[target.x86_64-pc-windows-msvc]' >> .cargo/config
echo 'rustflags = ["-Ctarget-feature=+crt-static"]' >> .cargo/config
- name: Build binary
run: |
cargo build --verbose --release
mv target/release/eslauncher2.exe eslauncher2-x86_64-pc-windows-msvc.exe
- name: Archive binary
uses: actions/upload-artifact@v3
with:
name: eslauncher2-x86_64-pc-windows-msvc
path: eslauncher2-x86_64-pc-windows-msvc.exe
- name: Release binary
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
eslauncher2-x86_64-pc-windows-msvc.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
macos:
runs-on: macOS-latest
steps:
- uses: hecrj/setup-rust-action@v1
- uses: actions/checkout@v2
- name: Build binary
env:
MACOSX_DEPLOYMENT_TARGET: 10.14
run: |
cargo build --verbose --release
chmod 755 target/release/eslauncher2
ls -al target/release
- name: Package binary
run: |
cargo install cargo-bundle
cargo bundle --release
ls -al target/release/bundle/osx/ESLauncher2.app/Contents/MacOS
- name: Strip binary and mark as executable
run: |
strip target/release/bundle/osx/ESLauncher2.app/Contents/MacOS/eslauncher2
chmod 755 target/release/bundle/osx/ESLauncher2.app/Contents/MacOS/eslauncher2
ls -al target/release/bundle/osx/ESLauncher2.app/Contents/MacOS
- name: Package ourselves to prevent execution flag creep
run: |
cd target/release/bundle/osx
zip -r ESLauncher2.app.zip ESLauncher2.app
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ESLauncher2.app.zip
path: target/release/bundle/osx
- name: Release binary
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
target/release/bundle/osx/ESLauncher2.app.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}