Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TonybynMp4 committed Oct 17, 2024
2 parents 5e6a593 + 8e97584 commit 5757a0e
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/actions/bump-manifest-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const fs = require('fs')

const version = process.env.TGT_RELEASE_VERSION
const newVersion = version.replace('v', '')

const manifestFile = fs.readFileSync('fxmanifest.lua', {encoding: 'utf8'})

const versionStr = `version '${newVersion}'`
let newFileContent = manifestFile.replace(/\bversion\s+(.*)$/gm, versionStr)

if (!newFileContent.includes(versionStr)) {
newFileContent = manifestFile.replace(/\bgame\s+(.*)$/gm, `game 'gta5'\n${versionStr}`);
}

fs.writeFileSync('fxmanifest.lua', newFileContent)
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint
on: [push, pull_request_target]
jobs:
lint:
name: Lint Resource
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Lint
uses: iLLeniumStudios/fivem-lua-lint-action@v2
with:
capture: "junit.xml"
args: "-t --formatter JUnit"
extra_libs: ox_lib+mysql+qblocales+qbox+qbox_playerdata+qbox_lib
- name: Generate Lint Report
if: always()
uses: mikepenz/action-junit-report@v4
with:
report_paths: "**/junit.xml"
check_name: Linting Report
fail_on_failure: false
57 changes: 57 additions & 0 deletions .github/workflows/release-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "release-action"

on:
push:
tags:
- "v*"

jobs:
release-action:
name: "Create Release"
runs-on: "ubuntu-latest"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}

- name: Install ZIP
run: sudo apt install zip

- name: Bundle files
run: |
rm -rf ./.github ./.git
shopt -s extglob
mkdir ./${{ github.event.repository.name }}
cp -r !(${{ github.event.repository.name }}) ${{ github.event.repository.name }}
zip -r ./${{ github.event.repository.name }}.zip ./${{ github.event.repository.name }}
- name: Get App Token
uses: actions/create-github-app-token@v1
id: generate_token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ steps.generate_token.outputs.token }}
tag: ${{ github.ref_name }}
includeInvalidCommits: true
useGitmojis: false
writeToFile: false

- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
artifacts: ${{ github.event.repository.name }}.zip
token: ${{ steps.generate_token.outputs.token }}
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create New Release

on:
workflow_dispatch:
inputs:
version:
required: true

jobs:
create-release:
name: Create New Release
runs-on: ubuntu-latest
steps:
- name: Get App Token
uses: actions/create-github-app-token@v1
id: generate_token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Bump manifest version
run: node .github/actions/bump-manifest-version.js
env:
TGT_RELEASE_VERSION: ${{ inputs.version }}

- name: Push manifest change
uses: EndBug/add-and-commit@v9
with:
add: fxmanifest.lua
push: true
message: 'chore: bump manifest version to ${{ inputs.version }}'
tag: ${{ inputs.version }}

0 comments on commit 5757a0e

Please sign in to comment.