Skip to content

Commit ccb56d5

Browse files
move bindings gen to actions
1 parent ef60be3 commit ccb56d5

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Generate Bindings (Bevy, Glam)
2+
3+
on:
4+
workflow_call:
5+
# inputs:
6+
# config-path:
7+
# required: true
8+
# type: string
9+
# secrets:
10+
# token:
11+
# required: true
12+
workflow_dispatch:
13+
14+
env:
15+
RUST_TOOLCHAIN: nightly-2024-12-15
16+
BEVY_API_GEN_PATH: ./crates/bevy_api_gen
17+
CODEGEN_PATH: ./target/codegen
18+
OUTPUT_PATH: ./crates/bevy_mod_scripting_functions/src/bevy/
19+
BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded
20+
jobs:
21+
generate_bindings:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
- name: Install toolchain
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: ${{ env.RUST_TOOLCHAIN }}
30+
components: rust-src, rustc-dev, llvm-tools-preview
31+
override: true
32+
- name: Install bevy_api_gen binaries
33+
run: cargo install --path ${{ env.BEVY_API_GEN_PATH }}
34+
- name: read bevy workspace version
35+
uses: SebRollen/toml-action@v1.2.0
36+
id: read_toml
37+
with:
38+
file: 'Cargo.toml'
39+
field: 'workspace.dependencies.bevy.version'
40+
- name: Clone Bevy
41+
run:
42+
mkdir ${{ env.CODEGEN_PATH }} || true
43+
git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.CODEGEN_PATH }}/bevy
44+
cd ${{ env.CODEGEN_PATH }}/bevy && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }}
45+
- name: Generate bevy bindings
46+
working-directory: ${{ env.CODEGEN_PATH }}/bevy
47+
run: >
48+
cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv
49+
cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}'
50+
- name: Commit changes
51+
run: |
52+
git checkout -b update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT
53+
git add -A
54+
git commit -m "chore(codegen): update bevy bindings"
55+
git push -u origin update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT
56+
- name: Create PR
57+
run: |
58+
gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings" --base ${{ github.ref }} --head update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT

0 commit comments

Comments
 (0)