From f974112d2b7458df4fdf7f12c0a0985d8b36d8f2 Mon Sep 17 00:00:00 2001 From: Serkyo Date: Tue, 12 May 2026 12:07:39 +0200 Subject: [PATCH] ci(workspace): add release workflow and fix lua CI scripts --- .github/workflows/ci.yml | 19 +++++++++++-------- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb43d79..ad27b10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: cargo fmt --all -- --check - name: Run Clippy - # -D warnings turns all clippy warnings into hard errors that fail the build + # The `-D warnings` flag converts all clippy warnings into hard errors, causing the build to fail. run: cargo clippy --all-targets --all-features -- -D warnings lua-lint: @@ -41,12 +41,13 @@ jobs: version: latest - name: Check Lua Formatting - # We use a glob that won't fail if the directories don't exist yet + # A conditional search is used to prevent failures when no Lua files exist yet. run: | - if [ -d "assets/scripts" ] || [ -d "mods" ]; then - stylua --check assets/scripts/ mods/ 2>/dev/null || true + LUA_FILES=$(find assets/scripts mods -name "*.lua" 2>/dev/null || true) + if [ -z "$LUA_FILES" ]; then + echo "No Lua files found to format." else - echo "No Lua scripts found to format yet." + echo "$LUA_FILES" | xargs stylua --check fi - name: Install Selene @@ -55,9 +56,11 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Run Selene + # A conditional search is used to prevent failures when no Lua files exist yet. run: | - if [ -d "assets/scripts" ] || [ -d "mods" ]; then - selene assets/scripts/ mods/ 2>/dev/null || true + LUA_FILES=$(find assets/scripts mods -name "*.lua" 2>/dev/null || true) + if [ -z "$LUA_FILES" ]; then + echo "No Lua files found to lint." else - echo "No Lua scripts found to lint yet." + echo "$LUA_FILES" | xargs selene fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..cc9804b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release + +on: + push: + # The workflow triggers only when a tag matching the pattern (e.g., v0.1.0) is pushed. + tags: + - "v*.*.*" + +jobs: + create-release: + name: Create GitHub Release + runs-on: ubuntu-latest + # Write permission is required for the action to create a release. + permissions: + contents: write + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + # Release notes are generated automatically based on pull requests merged since the last tag. + generate_release_notes: true + + # NOTE: Build steps can be added prior to this step to compile platform binaries. + # The resulting artifacts can then be attached to the release using the `files` parameter.