From 9d2fbd5adf1990f262d4cb59b40dfbd01e636490 Mon Sep 17 00:00:00 2001 From: James Bell Date: Mon, 15 Apr 2024 19:44:03 -0400 Subject: [PATCH] Fix github actions and minor demo changes --- .github/workflows/publish.yaml | 48 ++++++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- crates/bevy_tiles/examples/basic_2d.rs | 25 +++----------- crates/bevy_tiles/examples/basic_3d.rs | 36 ++++--------------- 5 files changed, 60 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..6a4e655 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + tags: + - '*' + +env: + add_binaries_to_github_release: true + use_git_lfs: true + + +jobs: + + # Build for Linux + release-linux: + runs-on: ubuntu-latest + environment: publish + + steps: + - uses: actions/checkout@v4 + with: + lfs: ${{ env.use_git_lfs }} + - uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-unknown-linux-gnu + - name: install dependencies + run: | + 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 + + - name: Test + run: | + cargo test --release --target x86_64-unknown-linux-gnu + + - name: Get Dependency + run: | + cargo install cargo-release + + - name: Login + run: | + cargo login ${{ secrets.CARGO_TOKEN }} + + - name: Publish + run: | + cargo release publish \ + --workspace \ + --execute \ + --all-features \ diff --git a/Cargo.lock b/Cargo.lock index 1341623..a53bea6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -912,7 +912,7 @@ dependencies = [ [[package]] name = "bevy_tiles" -version = "0.0.0-dev2" +version = "0.0.0-dev3" dependencies = [ "bevy", "bimap", diff --git a/Cargo.toml b/Cargo.toml index 1600715..65664c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members=[ ] [workspace.package] -version = "0.0.0-dev2" +version = "0.0.0-dev3" edition = "2021" authors = ["James Bell "] license = "MIT" diff --git a/crates/bevy_tiles/examples/basic_2d.rs b/crates/bevy_tiles/examples/basic_2d.rs index 9c90321..3868019 100644 --- a/crates/bevy_tiles/examples/basic_2d.rs +++ b/crates/bevy_tiles/examples/basic_2d.rs @@ -64,28 +64,11 @@ fn move_character( let map_id = map.single(); let walls = walls_maps.get_map(map_id).unwrap(); - let mut x = if keyboard_input.just_pressed(KeyCode::KeyA) { - -1 - } else { - 0 - }; - x += if keyboard_input.just_pressed(KeyCode::KeyD) { - 1 - } else { - 0 - }; + let x = keyboard_input.just_pressed(KeyCode::KeyD) as isize + - keyboard_input.just_pressed(KeyCode::KeyA) as isize; - let mut y = if keyboard_input.just_pressed(KeyCode::KeyW) { - 1 - } else { - 0 - }; - - y -= if keyboard_input.just_pressed(KeyCode::KeyS) { - 1 - } else { - 0 - }; + let y = keyboard_input.just_pressed(KeyCode::KeyW) as isize + - keyboard_input.just_pressed(KeyCode::KeyS) as isize; let char_c = character.get_single().unwrap(); let new_coord = [char_c[0] + x, char_c[1] + y]; diff --git a/crates/bevy_tiles/examples/basic_3d.rs b/crates/bevy_tiles/examples/basic_3d.rs index 875c666..2514133 100644 --- a/crates/bevy_tiles/examples/basic_3d.rs +++ b/crates/bevy_tiles/examples/basic_3d.rs @@ -114,38 +114,14 @@ fn move_character( let map_id = map.single(); let walls = walls_maps.get_map(map_id).unwrap(); - let mut x = if keyboard_input.just_pressed(KeyCode::KeyA) { - -1 - } else { - 0 - }; - x += if keyboard_input.just_pressed(KeyCode::KeyD) { - 1 - } else { - 0 - }; + let x = keyboard_input.just_pressed(KeyCode::KeyD) as isize + - keyboard_input.just_pressed(KeyCode::KeyA) as isize; - let mut z = if keyboard_input.just_pressed(KeyCode::KeyW) { - -1 - } else { - 0 - }; - z += if keyboard_input.just_pressed(KeyCode::KeyS) { - 1 - } else { - 0 - }; + let y = keyboard_input.just_pressed(KeyCode::ShiftLeft) as isize + - keyboard_input.just_pressed(KeyCode::ControlLeft) as isize; - let mut y = if keyboard_input.just_pressed(KeyCode::ShiftLeft) { - 1 - } else { - 0 - }; - y -= if keyboard_input.just_pressed(KeyCode::ControlLeft) { - 1 - } else { - 0 - }; + let z = keyboard_input.just_pressed(KeyCode::KeyS) as isize + - keyboard_input.just_pressed(KeyCode::KeyW) as isize; let char_c = character.get_single().unwrap(); let new_coord = [char_c[0] + x, char_c[1] + y, char_c[2] + z];