diff --git a/.github/actions/bump-manifest-version.js b/.github/actions/bump-manifest-version.js new file mode 100644 index 0000000..30c5507 --- /dev/null +++ b/.github/actions/bump-manifest-version.js @@ -0,0 +1,10 @@ +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 newFileContent = manifestFile.replace(/\bversion\s+(.*)$/gm, `version '${newVersion}'`) + +fs.writeFileSync('fxmanifest.lua', newFileContent) \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd853b4..96b9afa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - "v*" + - "v*.*.*" jobs: create-release: @@ -13,10 +13,12 @@ jobs: - name: Install archive tools run: sudo apt install zip - - uses: actions/checkout@v2 + - name: Checkout source code + uses: actions/checkout@v2 with: fetch-depth: 0 - ref: ${{ github.ref }} + ref: ${{ github.event.repository.default_branch }} + - uses: pnpm/action-setup@v2.0.1 with: version: 6.20.3 @@ -41,6 +43,25 @@ jobs: env: CI: false + - name: Bump manifest version + run: node .github/actions/bump-manifest-version.js + env: + TGT_RELEASE_VERSION: ${{ github.ref_name }} + + - name: Push manifest change + uses: EndBug/add-and-commit@v8 + with: + add: fxmanifest.lua + push: true + author_name: Manifest Bumper + author_email: 41898282+github-actions[bot]@users.noreply.github.com + message: "chore: bump manifest version to ${{ github.ref_name }}" + + - name: Update tag ref + uses: EndBug/latest-tag@latest + with: + tag-name: ${{ github.ref_name }} + - name: Bundle files run: | mkdir -p ./temp/ox_lib