-
-
Notifications
You must be signed in to change notification settings - Fork 78
228 lines (225 loc) · 7.85 KB
/
build.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: Build selene
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Build (Default features)
run: |
cd selene
cargo build --locked --release
- name: Upload selene
uses: actions/upload-artifact@v4
with:
name: selene-windows
path: ./target/release/selene.exe
build_windows_light:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Build (Lightweight)
run: |
cd selene
cargo build --locked --release --verbose --no-default-features
- name: Upload selene-light
uses: actions/upload-artifact@v4
with:
name: selene-light-windows
path: ./target/release/selene.exe
build_mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Build (Default features)
run: |
source $HOME/.cargo/env
cd selene
cargo build --locked --release
- name: Upload selene
uses: actions/upload-artifact@v4
with:
name: selene-macos
path: ./target/release/selene
build_mac_light:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Build (Lightweight)
run: |
source $HOME/.cargo/env
cd selene
cargo build --locked --release --verbose --no-default-features
- name: Upload selene-light
uses: actions/upload-artifact@v4
with:
name: selene-light-macos
path: ./target/release/selene
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build (Default features)
run: |
cd selene
cargo build --locked --release
- name: Upload selene
uses: actions/upload-artifact@v4
with:
name: selene-linux
path: ./target/release/selene
- name: Build arm64 (Default features)
uses: actions-rs/cargo@v1
with:
working-directory: selene
use-cross: true
command: build
args: --locked --release --target aarch64-unknown-linux-gnu
- name: Upload selene arm64
uses: actions/upload-artifact@v4
with:
name: selene-linux-aarch64
path: ./target/aarch64-unknown-linux-gnu/release/selene
build_linux_light:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build (Lightweight)
run: |
cd selene
cargo build --locked --release --verbose --no-default-features
- name: Upload selene-light
uses: actions/upload-artifact@v4
with:
name: selene-light-linux
path: ./target/release/selene
- name: Build arm64 (Lightweight)
uses: actions-rs/cargo@v1
with:
working-directory: selene
use-cross: true
command: build
args: --locked --release --verbose --no-default-features --target aarch64-unknown-linux-gnu
- name: Upload selene-light arm64
uses: actions/upload-artifact@v4
with:
name: selene-light-linux-aarch64
path: ./target/aarch64-unknown-linux-gnu/release/selene
release:
runs-on: ubuntu-latest
needs: ['build_windows_light', 'build_windows', 'build_mac', 'build_mac_light', 'build_linux', 'build_linux_light']
if: contains(github.event.head_commit.message, '[release]')
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- run: |
zip -rj selene-light-linux.zip ./artifacts/selene-light-linux/*
zip -rj selene-light-macos.zip ./artifacts/selene-light-macos/*
zip -rj selene-light-windows.zip ./artifacts/selene-light-windows/*
zip -rj selene-linux.zip ./artifacts/selene-linux/*
zip -rj selene-macos.zip ./artifacts/selene-macos/*
zip -rj selene-windows.zip ./artifacts/selene-windows/*
VERSION=`grep -Po '(?<=^version = ")([^"]+)' ./Cargo.toml`
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Get changelog
run: |
CHANGELOG_ENTRY=`grep --color=never -m 1 -Po '## \K(\[[0-9\.]+\].+)' CHANGELOG.md | sed -E 's/\(.+?\)//g'`
DESCRIPTION=`bash ./misc/extract-changelog.sh $CHANGELOG_ENTRY`
echo "CHANGELOG_ENTRY=$CHANGELOG_ENTRY" >> $GITHUB_ENV
echo "CHANGELOG_DESCRIPTION<<EOF" >> $GITHUB_ENV
echo "$DESCRIPTION" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.CHANGELOG_ENTRY }}
body: ${{ env.CHANGELOG_DESCRIPTION }}
- name: Upload Linux build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./selene-linux.zip
asset_name: selene-${{ env.VERSION }}-linux.zip
asset_content_type: application/zip
- name: Upload Linux build (light)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./selene-light-linux.zip
asset_name: selene-light-${{ env.VERSION }}-linux.zip
asset_content_type: application/zip
- name: Upload Windows build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./selene-windows.zip
asset_name: selene-${{ env.VERSION }}-windows.zip
asset_content_type: application/zip
- name: Upload Windows build (light)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./selene-light-windows.zip
asset_name: selene-light-${{ env.VERSION }}-windows.zip
asset_content_type: application/zip
- name: Upload Mac build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./selene-macos.zip
asset_name: selene-${{ env.VERSION }}-macos.zip
asset_content_type: application/zip
- name: Upload Mac build (light)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./selene-light-macos.zip
asset_name: selene-light-${{ env.VERSION }}-macos.zip
asset_content_type: application/zip
- uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: boyned/selene
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}