-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (128 loc) · 5.14 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
name: Release
on:
workflow_dispatch:
push:
tags: "v*"
jobs:
metadata:
runs-on: ubuntu-latest
outputs:
rust-version: ${{ steps.determine-rust-version.outputs.version }}
engine-version: ${{ steps.determine-engine-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: determine-rust-version
name: Determine Rust version
run: |
version=$(grep -m 1 'rust-version' Cargo.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
echo "Rust version: $version"
echo "version=$version" >> "$GITHUB_OUTPUT"
- id: determine-engine-version
name: Determine Engine version
run: |
version="${GITHUB_REF##*/}"
echo "Engine version: $version"
echo "version=$version" >> "$GITHUB_OUTPUT"
build-linux:
runs-on: ubuntu-latest
needs: [metadata]
strategy:
matrix:
include:
- exec_postfix: "x86_64-v4"
rustflags: "-Ctarget-feature=+crt-static,-bmi2 -Ctarget-cpu=x86-64-v4"
- exec_postfix: "x86_64-v3"
rustflags: "-Ctarget-feature=+crt-static,-bmi2 -Ctarget-cpu=x86-64-v3"
- exec_postfix: "x86_64-v2"
rustflags: "-Ctarget-feature=+crt-static -Ctarget-cpu=x86-64-v2"
- exec_postfix: "x86_64-v1"
rustflags: "-Ctarget-feature=+crt-static"
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install -y musl-tools
- name: Build
env:
RUSTFLAGS: '${{ matrix.rustflags }}'
run: |
rustup override set ${{ needs.metadata.outputs.rust-version }}
rustup target add x86_64-unknown-linux-musl
cargo build --release --no-default-features --features release --target x86_64-unknown-linux-musl
mv target/x86_64-unknown-linux-musl/release/engine tcheran-${{ needs.metadata.outputs.engine-version }}-linux-${{ matrix.exec_postfix }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tcheran-linux-${{ matrix.exec_postfix }}
path: tcheran-${{ needs.metadata.outputs.engine-version }}-linux-${{ matrix.exec_postfix }}
build-windows:
runs-on: windows-latest
needs: [metadata]
strategy:
matrix:
include:
- exec_postfix: "x86_64-v4"
rustflags: "-Ctarget-feature=+crt-static,-bmi2 -Ctarget-cpu=x86-64-v4"
- exec_postfix: "x86_64-v3"
rustflags: "-Ctarget-feature=+crt-static,-bmi2 -Ctarget-cpu=x86-64-v3"
- exec_postfix: "x86_64-v2"
rustflags: "-Ctarget-feature=+crt-static -Ctarget-cpu=x86-64-v2"
- exec_postfix: "x86_64-v1"
rustflags: "-Ctarget-feature=+crt-static"
steps:
- uses: actions/checkout@v4
- name: Build
env:
RUSTFLAGS: '${{ matrix.rustflags }}'
CFLAGS: '/std:c11 /experimental:c11atomics'
run: |
rustup override set ${{ needs.metadata.outputs.rust-version }}
rustup target add x86_64-pc-windows-msvc
cargo build --release --no-default-features --features release --target x86_64-pc-windows-msvc
mv .\target\x86_64-pc-windows-msvc\release\engine.exe tcheran-${{ needs.metadata.outputs.engine-version }}-windows-${{ matrix.exec_postfix }}.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tcheran-windows-${{ matrix.exec_postfix }}
path: tcheran-${{ needs.metadata.outputs.engine-version }}-windows-${{ matrix.exec_postfix }}.exe
build-macos:
runs-on: macos-14
needs: [metadata]
steps:
- uses: actions/checkout@v4
- name: Build
env:
RUSTFLAGS: '${{ matrix.rustflags }}'
run: |
rustup override set ${{ needs.metadata.outputs.rust-version }}
rustup target add aarch64-apple-darwin
cargo build --release --no-default-features --features release --target aarch64-apple-darwin
mv target/aarch64-apple-darwin/release/engine tcheran-${{ needs.metadata.outputs.engine-version }}-macos
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tcheran-macos
path: tcheran-${{ needs.metadata.outputs.engine-version }}-macos
release:
needs: [metadata, build-linux, build-windows, build-macos]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: tcheran-*
path: bins
merge-multiple: true
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
changelog_anchor=$(echo ${{ needs.metadata.outputs.engine-version }} | tr -d 'v.')
chmod +x bins/*linux*
chmod +x bins/*macos*
gh release create --draft \
--notes "https://github.com/jgilchrist/tcheran/blob/master/CHANGELOG.md#${changelog_anchor}" \
--title ${{ needs.metadata.outputs.engine-version }} \
${{ needs.metadata.outputs.engine-version }} \
bins/*