Skip to content

Commit 6c4d738

Browse files
committed
ci: Created Release Flow
1 parent 2ea84f7 commit 6c4d738

6 files changed

Lines changed: 158 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
release-please:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
releases_created: ${{ steps.release.outputs.releases_created }}
19+
tag_name: ${{ steps.release.outputs.tag_name }}
20+
steps:
21+
- uses: actions/create-github-app-token@v2
22+
id: app-token
23+
with:
24+
app-id: ${{ vars.APP_ID }}
25+
private-key: ${{ secrets.APP_KEY }}
26+
27+
- uses: googleapis/release-please-action@v4
28+
id: release
29+
with:
30+
token: ${{ steps.app-token.outputs.token }}
31+
32+
build:
33+
needs: release-please
34+
if: ${{ needs.release-please.outputs.releases_created == 'true' }}
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
include:
39+
- name: linux-x86_64
40+
os: ubuntu-latest
41+
target: x86_64-unknown-linux-gnu
42+
- name: macos-aarch64
43+
os: macos-14
44+
target: aarch64-apple-darwin
45+
- name: windows-x86_64
46+
os: windows-latest
47+
target: x86_64-pc-windows-msvc
48+
runs-on: ${{ matrix.os }}
49+
steps:
50+
- uses: actions/create-github-app-token@v2
51+
id: app-token
52+
with:
53+
app-id: ${{ vars.APP_ID }}
54+
private-key: ${{ secrets.APP_KEY }}
55+
56+
- uses: actions/checkout@v4
57+
58+
- name: Install Linux system dependencies
59+
if: runner.os == 'Linux'
60+
run: |
61+
sudo apt-get update
62+
sudo apt-get install -y --no-install-recommends \
63+
pkg-config \
64+
libasound2-dev \
65+
libudev-dev \
66+
libwayland-dev \
67+
libxkbcommon-dev \
68+
libx11-dev \
69+
libxcursor-dev \
70+
libxrandr-dev \
71+
libxi-dev \
72+
libgl1-mesa-dev
73+
74+
- name: Install Rust toolchain
75+
uses: dtolnay/rust-toolchain@stable
76+
with:
77+
targets: ${{ matrix.target }}
78+
79+
- name: Cache cargo
80+
uses: Swatinem/rust-cache@v2
81+
with:
82+
key: ${{ matrix.target }}
83+
84+
- name: Build
85+
run: >
86+
cargo build -p lifthrasir
87+
--profile dist
88+
--no-default-features
89+
--locked
90+
--target ${{ matrix.target }}
91+
92+
- name: Package (unix)
93+
if: runner.os != 'Windows'
94+
shell: bash
95+
run: |
96+
staging="lifthrasir-${{ needs.release-please.outputs.tag_name }}-${{ matrix.name }}"
97+
mkdir -p "$staging"
98+
cp "target/${{ matrix.target }}/dist/lifthrasir" "$staging/"
99+
cp -r assets "$staging/"
100+
cp README.md LICENSE "$staging/"
101+
tar -czf "$staging.tar.gz" "$staging"
102+
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
103+
104+
- name: Package (windows)
105+
if: runner.os == 'Windows'
106+
shell: pwsh
107+
run: |
108+
$staging = "lifthrasir-${{ needs.release-please.outputs.tag_name }}-${{ matrix.name }}"
109+
New-Item -ItemType Directory -Force -Path $staging | Out-Null
110+
Copy-Item "target/${{ matrix.target }}/dist/lifthrasir.exe" "$staging/"
111+
Copy-Item -Recurse assets "$staging/assets"
112+
Copy-Item README.md, LICENSE "$staging/"
113+
Compress-Archive -Path $staging -DestinationPath "$staging.zip"
114+
"ASSET=$staging.zip" | Out-File -FilePath $env:GITHUB_ENV -Append
115+
116+
- name: Upload to release
117+
shell: bash
118+
env:
119+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
120+
run: gh release upload "${{ needs.release-please.outputs.tag_name }}" "$ASSET" --clobber

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.0.1"
3+
}

Cargo.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@ members = [
1111
]
1212

1313
[workspace.package]
14-
version = "0.1.0"
14+
version = "0.0.1"
1515
edition = "2021"
1616

1717
[workspace.dependencies]
18-
bevy = { version = "0.18.1", features = [
19-
"jpeg",
20-
"trace",
21-
"trace_tracy",
22-
"bevy_remote",
23-
] }
18+
bevy = { version = "0.18.1", features = ["jpeg", "wayland"] }
2419
secrecy = { version = "0.10", features = ["serde"] }
2520
bevy_ui_text_input = "0.7.0"
2621
leafwing-input-manager = "0.20"
@@ -32,3 +27,11 @@ opt-level = 3
3227

3328
[profile.dev]
3429
opt-level = 1
30+
31+
[profile.dist]
32+
inherits = "release"
33+
opt-level = 3
34+
lto = "fat"
35+
codegen-units = 1
36+
panic = "abort"
37+
strip = true

lifthrasir/Cargo.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@ name = "lifthrasir"
33
version.workspace = true
44
edition.workspace = true
55

6+
[features]
7+
default = ["dev"]
8+
# Profiling and live-inspection tooling. On by default for local development,
9+
# disabled for distribution builds via `--no-default-features`.
10+
dev = [
11+
"bevy/trace",
12+
"bevy/trace_tracy",
13+
"bevy/bevy_remote",
14+
"dep:bevy_brp_extras",
15+
]
16+
617
[dependencies]
718
bevy = { workspace = true }
819
bevy_framepace = "0.21"
9-
bevy_brp_extras = "0.19.0"
20+
bevy_brp_extras = { version = "0.19.0", optional = true }
1021
game-engine = { path = "../game-engine" }
1122
lifthrasir-ui = { path = "../lifthrasir-ui" }
1223
toml = "0.9"

lifthrasir/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn main() {
2626
.resource_mut::<bevy_framepace::FramepaceSettings>()
2727
.limiter = bevy_framepace::Limiter::from_framerate(FRAMERATE_LIMIT);
2828

29-
#[cfg(debug_assertions)]
29+
#[cfg(feature = "dev")]
3030
app.add_plugins((
3131
bevy::diagnostic::FrameTimeDiagnosticsPlugin::default(),
3232
bevy_brp_extras::BrpExtrasPlugin::default(),

release-please-config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"bump-minor-pre-major": true,
4+
"packages": {
5+
".": {
6+
"release-type": "rust",
7+
"package-name": "lifthrasir",
8+
"include-component-in-tag": false,
9+
"changelog-path": "CHANGELOG.md"
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)