-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (99 loc) · 3.37 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
name: Build and Upload Release
on:
push:
tags:
- '**'
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, runner-mac-m1]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
if: matrix.os != 'runner-mac-m1'
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-
if: ${{ matrix.os }} != 'runner-mac-m1'
- name: Get SDL2
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
sudo apt-get update
sudo apt-get install -y libsdl2-dev
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
brew install SDL2
elif [ "${{ matrix.os }}" == "windows-latest" ]; then
cp include/windows/* .
fi
shell: bash
if: ${{ matrix.os }} != 'gregoireh-1_macos-arm64-M1'
- name: Set environment
run: |
if [ "${{ matrix.os }}" == "windows-latest" ]; then
PLATFORM=windows
elif [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
PLATFORM=ubuntu
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
PLATFORM=macos-x86_64
elif [ "${{ matrix.os }}" == "runner-mac-m1" ]; then
PLATFORM=macos-arm64
fi
if [ "${{ matrix.os }}" == "windows-latest" ]; then
EXT=.exe
OUT_EXT=.exe
else
EXT=
OUT_EXT=.tar.gz
fi
BUNDLE_NAME=kalast-$GITHUB_REF_NAME-$PLATFORM
RELEASE_FILE=$BUNDLE_NAME$OUT_EXT
echo "PLATFORM=$PLATFORM" >> "$GITHUB_ENV"
echo "EXT=$EXT" >> "$GITHUB_ENV"
echo "OUT_EXT=$OUT_EXT" >> "$GITHUB_ENV"
echo "BUNDLE_NAME=$BUNDLE_NAME" >> "$GITHUB_ENV"
echo "RELEASE_FILE=$RELEASE_FILE" >> "$GITHUB_ENV"
shell: bash
- name: Build
run: |
echo "Build main executable."
cargo build -r --all-features && strip target/release/kalast$EXT
# echo "Build custom executable for specific example."
# cargo build -r --all-features --example viewer-picker && strip target/release/examples/viewer-picker$EXT
shell: bash
- name: Prepare bundle
run: |
mkdir -p bundle
cp -r examples bundle
cp target/release/kalast$EXT bundle
# cp target/release/examples/viewer-picker$EXT bundle/examples/viewer-picker
cp include/kalast.ico bundle
cp -r include/assets bundle
cp preferences.toml bundle
cp README.md bundle
if [ "${{ matrix.os }}" == "windows-latest" ]; then
cp include/windows/* bundle
fi
cd bundle
cp -r examples/viewer/cfg .
cd ..
shell: bash
- name: Finish bundle Linux/MacOS
if: matrix.os != 'windows-latest'
run: |
mv bundle $BUNDLE_NAME
tar cvzf $RELEASE_FILE $BUNDLE_NAME
- name: Finish bundle Windows
if: matrix.os == 'windows-latest'
run: |
cp scripts\installer.iss .
iscc installer.iss /DVERSION=${{ github.ref_name }} /DSETUP_NAME=${{ env.BUNDLE_NAME }}
- uses: softprops/action-gh-release@v1
with:
files: ${{ env.RELEASE_FILE }}
prerelease: true