Skip to content

Refresh FiveM Natives #603

Refresh FiveM Natives

Refresh FiveM Natives #603

name: Refresh FiveM Natives
on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
permissions:
contents: write
packages: write
env:
REGISTRY: ghcr.io
OWNER: ${{ github.repository_owner }}
IMAGE_NAME: fivem-lua-lint
jobs:
refresh-natives:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate latest natives
run: pnpm build
- name: Commit changes
id: commit
run: |
if git diff --quiet -- .luacheckrc.default .luacheckrc.generated.template .natives-snapshot.json; then
echo "No changes detected"
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .luacheckrc.default .luacheckrc.generated.template .natives-snapshot.json
git commit -m "chore: refresh fivem native definitions"
git push
echo "changed=true" >> "$GITHUB_OUTPUT"
- name: If manual trigger, force update
id: force-update
if: github.event_name == 'workflow_dispatch'
run: |
echo "Forcing update on manual trigger"
echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Log in to the Container registry
if: steps.commit.outputs.changed == 'true' || steps.force-update.outputs.changed == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
if: steps.commit.outputs.changed == 'true' || steps.force-update.outputs.changed == 'true'
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: steps.commit.outputs.changed == 'true' || steps.force-update.outputs.changed == 'true'
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
if: steps.commit.outputs.changed == 'true' || steps.force-update.outputs.changed == 'true'
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}
tags : |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push docker image
if: steps.commit.outputs.changed == 'true' || steps.force-update.outputs.changed == 'true'
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max