Skip to content

Update fivem-release.yml #1

Update fivem-release.yml

Update fivem-release.yml #1

Workflow file for this run

name: FiveM Auto Version & Release
on:
workflow_call:
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Debug fxmanifest
run: |
echo "Checking fxmanifest.lua file..."
if [ ! -f fxmanifest.lua ]; then
echo "❌ fxmanifest.lua not found!"
exit 1
fi
cat fxmanifest.lua
- name: Bump version
id: bump_version
run: |
OLD_VERSION=$(grep -E "version ['\"]([0-9]+\.[0-9]+\.[0-9]+)['\"]" fxmanifest.lua | sed -E "s/.*version ['\"]([0-9]+\.[0-9]+\.[0-9]+)['\"].*/\1/")
if [ -z "$OLD_VERSION" ]; then
echo "❌ Version not found in fxmanifest.lua!"
exit 1
fi
echo "✅ Old version: $OLD_VERSION"
CUSTOM_VERSION="$(git log -1 --pretty=%B | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')"
if [ -n "$CUSTOM_VERSION" ]; then
NEW_VERSION=$CUSTOM_VERSION
else
IFS='.' read -r major minor patch <<< "$OLD_VERSION"
patch=$((patch + 1))
if [ "$patch" -gt 9 ]; then
patch=0
minor=$((minor + 1))
fi
if [ "$minor" -gt 9 ]; then
minor=0
major=$((major + 1))
fi
NEW_VERSION="${major}.${minor}.${patch}"
fi
sed -i -E "s/version ['\"][0-9]+\.[0-9]+\.[0-9]+['\"]/version '$NEW_VERSION'/" fxmanifest.lua
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "✅ New version: $NEW_VERSION"
- name: Commit updated manifest
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: Bump version to ${{ steps.bump_version.outputs.new_version }}"
- name: Prepare Escrow Version
run: |
mkdir escrow_version
rsync -av --exclude='.git/' --exclude='escrow_version/' --exclude='open_source_version/' ./ escrow_version/
- name: Prepare Open Source Version
run: |
mkdir open_source_version
rsync -av --exclude='.git/' --exclude='escrow_version/' --exclude='open_source_version/' ./ open_source_version/
sed -i '/escrow_ignore {/,/}/ s/^/--/' open_source_version/fxmanifest.lua
echo -e "escrow_ignore {\n '**.**',\n '**/**',\n '**/**/**'\n}" >> open_source_version/fxmanifest.lua
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ steps.bump_version.outputs.new_version }}"
files: |
escrow_version/**
open_source_version/**