diff --git a/.github/actions/bump-manifest-version.js b/.github/actions/bump-manifest-version.js new file mode 100644 index 0000000..c4aab9f --- /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 8b38c4b..7c6900d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,6 @@ jobs: create-release: name: Build and Create Tagged Release runs-on: ubuntu-latest - steps: - name: Install archive tools run: sudo apt install zip @@ -62,3 +61,26 @@ jobs: env: CI: false GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + bump-manifest-version: + name: 'Bump fxmanifest version' + needs: create-release + runs-on: ubuntu-latest + steps: + - name: Get tag + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Checkout + uses: actions/checkout@v2 + with: + ref: main + - name: Bump manifest version + run: node .github/actions/bump-manifest-version.js + env: + TGT_RELEASE_VERSION: ${{ env.RELEASE_VERSION }} + - 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): Bump manifest version to ${{ env.RELEASE_VERSION }}'