diff --git a/.github/workflows/semantic-bump-version.yml b/.github/workflows/semantic-bump-version.yml new file mode 100644 index 00000000..c21970c4 --- /dev/null +++ b/.github/workflows/semantic-bump-version.yml @@ -0,0 +1,89 @@ +name: Semantic Version Bump (Conventional Commits) + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + semver-bump: + runs-on: ubuntu-latest + if: github.event.head_commit.author.name != 'github-actions[bot]' + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Determine bump type from commit message + id: bump + run: | + COMMIT_MSG="${{ github.event.head_commit.message }}" + echo "🔍 Commit message: $COMMIT_MSG" + + if echo "$COMMIT_MSG" | grep -qE 'BREAKING CHANGE|!:'; then + echo "bump=major" >> $GITHUB_OUTPUT + elif echo "$COMMIT_MSG" | grep -qE '^feat(\(.+\))?:'; then + echo "bump=minor" >> $GITHUB_OUTPUT + elif echo "$COMMIT_MSG" | grep -qE '^fix(\(.+\))?:'; then + echo "bump=patch" >> $GITHUB_OUTPUT + else + echo "bump=none" >> $GITHUB_OUTPUT + fi + + - name: Bump version in fxmanifest.lua + if: steps.bump.outputs.bump != 'none' + run: | + FILE="fxmanifest.lua" + if [[ ! -f "$FILE" ]]; then + echo "ERROR: fxmanifest.lua not found. Exiting." + exit 1 + fi + + VERSION_LINE=$(grep -E "^ *version +['\"][0-9]+\.[0-9]+\.[0-9]+['\"]" "$FILE") + VERSION=$(echo "$VERSION_LINE" | grep -oE "[0-9]+\.[0-9]+\.[0-9]+") + IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" + + case "${{ steps.bump.outputs.bump }}" in + major) + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + ;; + minor) + MINOR=$((MINOR + 1)) + PATCH=0 + ;; + patch) + PATCH=$((PATCH + 1)) + ;; + esac + + NEW_VERSION="$MAJOR.$MINOR.$PATCH" + sed -i "s/version ['\"]$VERSION['\"]/version '$NEW_VERSION'/" "$FILE" + echo "new_version=$NEW_VERSION" >> $GITHUB_ENV + + - name: Commit and push version bump + if: steps.bump.outputs.bump != 'none' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add fxmanifest.lua + + if git diff --cached --quiet; then + echo "⚠️ No version changes to commit." + exit 0 + fi + + COMMIT_MSG="${{ github.event.head_commit.message }}" + git commit -m "ci: bump fxmanifest version to ${{ env.new_version }} – $COMMIT_MSG" + git push origin HEAD:main + + - name: Create and push Git tag + if: steps.bump.outputs.bump != 'none' + run: | + TAG="v${{ env.new_version }}" + git tag "$TAG" + git push origin "$TAG" diff --git a/client/seatbelt.lua b/client/seatbelt.lua index 18ee93b8..a0f2ac56 100644 --- a/client/seatbelt.lua +++ b/client/seatbelt.lua @@ -18,7 +18,6 @@ local lastVeh = nil local veloc -- Functions - local function ejectFromVehicle() local ped = PlayerPedId() local veh = GetVehiclePedIsIn(ped, false) @@ -92,7 +91,6 @@ end exports("HasSeatbeltOn", hasSeatbeltOn) -- Ejection Logic - RegisterNetEvent('QBCore:Client:EnteredVehicle', function() local ped = PlayerPedId() while IsPedInAnyVehicle(ped, false) do @@ -231,7 +229,6 @@ RegisterNetEvent('QBCore:Client:EnteredVehicle', function() end) -- Events - RegisterNetEvent('seatbelt:client:UseHarness', function(ItemData) -- On Item Use (registered server side) local ped = PlayerPedId() local inVeh = IsPedInAnyVehicle(ped, false) @@ -270,7 +267,6 @@ RegisterNetEvent('seatbelt:client:UseHarness', function(ItemData) -- On Item Use end) -- Register Key - RegisterCommand('toggleseatbelt', function() if not IsPedInAnyVehicle(PlayerPedId(), false) or IsPauseMenuActive() then return end local class = GetVehicleClass(GetVehiclePedIsUsing(PlayerPedId())) diff --git a/fxmanifest.lua b/fxmanifest.lua index 9ddd213f..ba32ddc5 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ lua54 'yes' use_experimental_fxv2_oal 'yes' author 'Kakarot' description 'Various small code snippets compiled into one resource for ease of use' -version '1.4.0' +version '2.0.0' shared_scripts { '@qb-core/shared/locale.lua', diff --git a/server/consumables.lua b/server/consumables.lua index 69df6db3..ac629141 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -8,7 +8,6 @@ for k, _ in pairs(Config.Consumables.alcohol) do end ----------- / Eat - for k, _ in pairs(Config.Consumables.eat) do QBCore.Functions.CreateUseableItem(k, function(source, item) if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:consumables:eat') then return end @@ -38,8 +37,8 @@ local function createItem(name, type) TriggerClientEvent('consumables:client:' .. type, source, item.name) end) end ------------ / Drug +----------- / Drug QBCore.Functions.CreateUseableItem('joint', function(source, item) if not exports['qb-inventory']:RemoveItem(source, item.name, 1, item.slot, 'qb-smallresources:joint') then return end TriggerClientEvent('consumables:client:UseJoint', source) @@ -66,7 +65,6 @@ QBCore.Functions.CreateUseableItem('meth', function(source) end) ----------- / Tools - QBCore.Functions.CreateUseableItem('armor', function(source) TriggerClientEvent('consumables:client:UseArmor', source) end) @@ -98,7 +96,6 @@ QBCore.Commands.Add('resetparachute', 'Resets Parachute', {}, false, function(so end) ----------- / Firework - for _, v in pairs(Config.Fireworks.items) do QBCore.Functions.CreateUseableItem(v, function(source, item) local src = source @@ -107,7 +104,6 @@ for _, v in pairs(Config.Fireworks.items) do end ----------- / Lockpicking - QBCore.Functions.CreateUseableItem('lockpick', function(source) TriggerClientEvent('lockpicks:UseLockpick', source, false) end) @@ -117,7 +113,6 @@ QBCore.Functions.CreateUseableItem('advancedlockpick', function(source) end) -- Events for adding and removing specific items to fix some exploits - RegisterNetEvent('consumables:server:AddParachute', function() local Player = QBCore.Functions.GetPlayer(source) if not Player then return end