-
-
Notifications
You must be signed in to change notification settings - Fork 89
177 lines (150 loc) · 5.03 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Release
on:
release:
types: [published]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos, win32, win64]
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: zemeroth
archive: .tar.gz
type: application/gzip
- build: macos
os: macOS-latest
target: x86_64-apple-darwin
bin: zemeroth
archive: .tar.gz
type: application/gzip
- build: win32
os: windows-latest
rust: stable-i686-pc-windows-msvc
target: i686-pc-windows-msvc
bin: zemeroth.exe
archive: .zip
type: application/zip
- build: win64
os: windows-latest
target: x86_64-pc-windows-msvc
bin: zemeroth.exe
archive: .zip
type: application/zip
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install packages (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get -yq --no-install-suggests --no-install-recommends install libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust || 'stable' }}
target: ${{ matrix.target }}
profile: minimal
override: true
- name: Install resvg
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cargo install resvg
elif [ "$RUNNER_OS" == "macOS" ]; then
cargo install resvg
elif [ "$RUNNER_OS" == "Windows" ]; then
curl -sL https://github.com/RazrFalcon/resvg/releases/download/v0.11.0/viewsvg-win.zip -O
7z x viewsvg-win.zip
mv resvg ~/.cargo/bin
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Export assets
shell: bash
run: |
./utils/assets_export.sh
ls -lR assets
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Package
id: package
shell: bash
env:
BUILD_NAME: ${{ matrix.build }}
ARCHIVE_EXT: ${{ matrix.archive }}
run: |
name=zemeroth
tag=$(git describe --tags --abbrev=0)
release_name="$name-$tag-$BUILD_NAME"
release_file="${release_name}${ARCHIVE_EXT}"
mkdir "$release_name"
if [ "${{ runner.os }}" = "Linux" ]; then
strip -s "target/${{ matrix.target }}/release/${{ matrix.bin }}"
elif [ "${{ runner.os }}" = "macOS" ]; then
strip "target/${{ matrix.target }}/release/${{ matrix.bin }}"
fi
cp target/${{ matrix.target }}/release/${{ matrix.bin }} "$release_name"
cp -r README.md assets "$release_name"
if [ "${{ runner.os }}" = "Windows" ]; then
7z a "$release_file" "$release_name"
else
tar czvf "$release_file" "$release_name"
fi
echo "::set-output name=asset_name::$release_file"
echo "::set-output name=asset_path::$release_file"
- name: Upload
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ steps.package.outputs.asset_name }}
asset_path: ${{ steps.package.outputs.asset_path }}
asset_content_type: ${{ matrix.type }}
wasm:
name: build (web)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Install resvg
run: cargo install resvg
- name: Export assets
run: ./utils/assets_export.sh
- name: Build
run: ./utils/wasm/build.sh
- name: Package
id: package
run: |
name=zemeroth
tag=$(git describe --tags --abbrev=0)
release_name="$name-$tag-web"
release_file="${release_name}.zip"
mkdir "$release_name"
cp README.md static/* "$release_name"
7z a "$release_file" "$release_name"
echo "::set-output name=asset_name::$release_file"
echo "::set-output name=asset_path::$release_file"
- name: Upload
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ steps.package.outputs.asset_name }}
asset_path: ${{ steps.package.outputs.asset_path }}
asset_content_type: application/zip