Skip to content

Commit 01f8f2a

Browse files
committed
chore: Deploy and upload native builds
1 parent 104f275 commit 01f8f2a

File tree

5 files changed

+209
-8
lines changed

5 files changed

+209
-8
lines changed

.github/workflows/release.yaml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,180 @@ jobs:
6666
tag: ${{ github.ref }}
6767
overwrite: true
6868

69+
release-linux:
70+
runs-on: ubuntu-latest
71+
72+
steps:
73+
- uses: olegtarasov/[email protected]
74+
id: get_version
75+
- uses: actions/checkout@v4
76+
- uses: dtolnay/rust-toolchain@stable
77+
with:
78+
targets: x86_64-unknown-linux-gnu
79+
- name: install dependencies
80+
run: |
81+
sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
82+
83+
- name: Build
84+
run: |
85+
cargo build --release --target x86_64-unknown-linux-gnu
86+
87+
- name: Prepare package
88+
run: |
89+
mkdir linux
90+
cp target/x86_64-unknown-linux-gnu/release/${{ env.binary }} linux/
91+
cp -r assets linux/
92+
93+
- name: Package as a zip
94+
working-directory: ./linux
95+
run: |
96+
zip --recurse-paths ../${{ env.binary }}.zip .
97+
98+
- name: Upload binaries to artifacts
99+
uses: actions/upload-artifact@v3
100+
with:
101+
path: ${{ env.binary }}.zip
102+
name: linux
103+
retention-days: 1
104+
105+
- name: Upload binaries to release
106+
if: ${{ env.add_binaries_to_github_release == 'true' }}
107+
uses: svenstaro/upload-release-action@v2
108+
with:
109+
repo_token: ${{ secrets.GITHUB_TOKEN }}
110+
file: ${{ env.binary }}.zip
111+
asset_name: ${{ env.binary }}-linux-${{ steps.get_version.outputs.tag }}.zip
112+
tag: ${{ github.ref }}
113+
overwrite: true
114+
115+
release-windows:
116+
runs-on: windows-latest
117+
118+
steps:
119+
- uses: olegtarasov/[email protected]
120+
id: get_version
121+
- uses: actions/checkout@v4
122+
- uses: dtolnay/rust-toolchain@stable
123+
with:
124+
targets: x86_64-pc-windows-msvc
125+
126+
- name: Build
127+
run: |
128+
cargo build --release --target x86_64-pc-windows-msvc
129+
130+
- name: Prepare package
131+
run: |
132+
mkdir windows
133+
cp target/x86_64-pc-windows-msvc/release/${{ env.binary }}.exe windows/
134+
cp -r assets windows/
135+
136+
- name: Package as a zip
137+
run: |
138+
Compress-Archive -Path windows/* -DestinationPath ${{ env.binary }}.zip
139+
140+
- name: Upload binaries to artifacts
141+
uses: actions/upload-artifact@v3
142+
with:
143+
path: ${{ env.binary }}.zip
144+
name: windows
145+
retention-days: 1
146+
147+
- name: Upload binaries to release
148+
if: ${{ env.add_binaries_to_github_release == 'true' }}
149+
uses: svenstaro/upload-release-action@v2
150+
with:
151+
repo_token: ${{ secrets.GITHUB_TOKEN }}
152+
file: ${{ env.binary }}.zip
153+
asset_name: ${{ env.binary }}-windows-${{ steps.get_version.outputs.tag }}.zip
154+
tag: ${{ github.ref }}
155+
overwrite: true
156+
157+
release-macOS-intel:
158+
runs-on: macOS-latest
159+
160+
steps:
161+
- uses: olegtarasov/[email protected]
162+
id: get_version
163+
- uses: actions/checkout@v4
164+
- uses: dtolnay/rust-toolchain@stable
165+
with:
166+
targets: x86_64-apple-darwin
167+
- name: Environment Setup
168+
run: |
169+
export CFLAGS="-fno-stack-check"
170+
export MACOSX_DEPLOYMENT_TARGET="10.9"
171+
172+
- name: Build
173+
run: |
174+
cargo build --release --target x86_64-apple-darwin
175+
176+
- name: Prepare Package
177+
run: |
178+
mkdir -p ${{ env.binary }}.app/Contents/MacOS
179+
cp target/x86_64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/
180+
cp -r assets ${{ env.binary }}.app/Contents/MacOS/
181+
hdiutil create -fs HFS+ -volname "${{ env.binary }}" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-intel.dmg
182+
183+
- name: Upload binaries to artifacts
184+
uses: actions/upload-artifact@v3
185+
with:
186+
path: ${{ env.binary }}-macOS-intel.dmg
187+
name: macOS-intel
188+
retention-days: 1
189+
190+
- name: Upload binaries to release
191+
if: ${{ env.add_binaries_to_github_release == 'true' }}
192+
uses: svenstaro/upload-release-action@v2
193+
with:
194+
repo_token: ${{ secrets.GITHUB_TOKEN }}
195+
file: ${{ env.binary }}-macOS-intel.dmg
196+
asset_name: ${{ env.binary }}-macOS-intel-${{ steps.get_version.outputs.tag }}.dmg
197+
tag: ${{ github.ref }}
198+
overwrite: true
199+
200+
release-macOS-apple-silicon:
201+
runs-on: macOS-latest
202+
203+
steps:
204+
- uses: olegtarasov/[email protected]
205+
id: get_version
206+
- uses: actions/checkout@v4
207+
- uses: dtolnay/rust-toolchain@stable
208+
with:
209+
targets: aarch64-apple-darwin
210+
- name: Environment
211+
# macOS 11 was the first version to support ARM
212+
run: |
213+
export MACOSX_DEPLOYMENT_TARGET="11"
214+
215+
- name: Build
216+
run: |
217+
cargo build --release --target aarch64-apple-darwin
218+
219+
- name: Prepare Package
220+
run: |
221+
mkdir -p ${{ env.binary }}.app/Contents/MacOS
222+
cp target/aarch64-apple-darwin/release/${{ env.binary }} ${{ env.binary }}.app/Contents/MacOS/
223+
cp -r assets ${{ env.binary }}.app/Contents/MacOS/
224+
hdiutil create -fs HFS+ -volname "${{ env.binary }}-macOS-apple-silicon" -srcfolder ${{ env.binary }}.app ${{ env.binary }}-macOS-apple-silicon.dmg
225+
226+
- name: Upload binaries to artifacts
227+
uses: actions/upload-artifact@v3
228+
with:
229+
path: ${{ env.binary }}-macOS-apple-silicon.dmg
230+
name: macOS-apple-silicon
231+
retention-days: 1
232+
233+
- name: Upload binaries to release
234+
if: ${{ env.add_binaries_to_github_release == 'true' }}
235+
uses: svenstaro/upload-release-action@v2
236+
with:
237+
repo_token: ${{ secrets.GITHUB_TOKEN }}
238+
file: ${{ env.binary }}-macOS-apple-silicon.dmg
239+
asset_name: ${{ env.binary }}-macOS-apple-silicon-${{ steps.get_version.outputs.tag }}.dmg
240+
tag: ${{ github.ref }}
241+
overwrite: true
242+
69243
check-if-upload-to-itch-is-configured:
70244
runs-on: ubuntu-latest
71245
outputs:
@@ -84,6 +258,10 @@ jobs:
84258
needs:
85259
- check-if-upload-to-itch-is-configured
86260
- release-wasm
261+
- release-linux
262+
- release-windows
263+
- release-macOS-intel
264+
- release-macOS-apple-silicon
87265
if: ${{ needs.check-if-upload-to-itch-is-configured.outputs.should-upload == 'yes' }}
88266

89267
steps:

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "insta-kill"
3-
version = "0.1.4"
3+
version = "0.1.5"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/ui/game_over.rs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,26 @@ fn spawn_player_score(commands: &mut Commands, font: Handle<Font>, score: u32) -
6565
commands.spawn(text_bundle).id()
6666
}
6767

68+
fn spawn_prompt(commands: &mut Commands, font: Handle<Font>) -> Entity {
69+
let text = format!("ENTER NAME:");
70+
let text_style = TextStyle {
71+
font,
72+
font_size: 30.0,
73+
color: Color::WHITE,
74+
};
75+
let text_bundle = TextBundle::from_sections([TextSection::new(text, text_style.clone())]);
76+
commands
77+
.spawn(text_bundle)
78+
.insert(Style {
79+
margin: UiRect {
80+
top: Val::Px(75.0),
81+
..default()
82+
},
83+
..default()
84+
})
85+
.id()
86+
}
87+
6888
fn spawn_restart_text(commands: &mut Commands, font: Handle<Font>) -> Entity {
6989
let text = "ESC to skip and restart".to_string();
7090
let text_style = TextStyle {
@@ -88,6 +108,7 @@ fn spawn_restart_text(commands: &mut Commands, font: Handle<Font>) -> Entity {
88108
fn spawn_text(commands: &mut Commands, font: Handle<Font>, score: u32) {
89109
let title_text = spawn_title(commands, font.clone());
90110
let score_text = spawn_player_score(commands, font.clone(), score);
111+
let prompt_text = spawn_prompt(commands, font.clone());
91112
let input_field = spawn_text_field(commands, font.clone());
92113
let restart_text = spawn_restart_text(commands, font.clone());
93114

@@ -96,7 +117,7 @@ fn spawn_text(commands: &mut Commands, font: Handle<Font>, score: u32) {
96117
GameOverScreen,
97118
NodeBundle {
98119
style: Style {
99-
top: Val::Percent(25.0),
120+
top: Val::Percent(15.0),
100121
width: Val::Percent(100.0),
101122
flex_direction: FlexDirection::Column,
102123
row_gap: Val::Vh(3.0),
@@ -108,7 +129,13 @@ fn spawn_text(commands: &mut Commands, font: Handle<Font>, score: u32) {
108129
..default()
109130
},
110131
))
111-
.push_children(&[title_text, score_text, input_field, restart_text]);
132+
.push_children(&[
133+
title_text,
134+
score_text,
135+
prompt_text,
136+
input_field,
137+
restart_text,
138+
]);
112139
}
113140

114141
fn spawn_game_over_screen(

src/ui/text_field.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ pub fn spawn_text_field(commands: &mut Commands, font: Handle<Font>) -> Entity {
104104
align_items: AlignItems::Center,
105105
width: Val::Px((2.0 * CHAR_SIZE + CHAR_OFFSET) * CHAR_PIXEL_FACTOR),
106106
height: Val::Px(42.0),
107-
margin: UiRect {
108-
top: Val::Px(75.0),
109-
..default()
110-
},
111107
..default()
112108
},
113109
background_color: TRANSPARENT_BACKGROUND.into(),

0 commit comments

Comments
 (0)