Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Commit 8ea5aad

Browse files
committed
ci(release): version bumper
1 parent 6135701 commit 8ea5aad

File tree

2 files changed

+43
-16
lines changed

2 files changed

+43
-16
lines changed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const fs = require('fs')
1+
const fs = require('fs');
22

3-
const version = process.env.TGT_RELEASE_VERSION
4-
const newVersion = version.replace('v', '')
3+
const version = process.env.TGT_RELEASE_VERSION;
4+
const newVersion = version.replace('v', '');
55

6-
const manifestFile = fs.readFileSync('fxmanifest.lua', {encoding: 'utf8'})
6+
const manifestFile = fs.readFileSync('fxmanifest.lua', { encoding: 'utf8' });
77

8-
const newFileContent = manifestFile.replace(/\bversion\s+(.*)$/gm, `version '${newVersion}'`)
8+
const newFileContent = manifestFile.replace(/\bversion\s+(.*)$/gm, `version '${newVersion}'`);
99

10-
fs.writeFileSync('fxmanifest.lua', newFileContent)
10+
fs.writeFileSync('fxmanifest.lua', newFileContent);

.github/workflows/release.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,68 @@
1-
name: Release
1+
name: Build
22

33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- 'v*.*.*'
77

88
jobs:
99
create-release:
10-
name: Build and Create Tagged Release
10+
name: Build and Create Tagged release
1111
runs-on: ubuntu-latest
12+
1213
steps:
1314
- name: Install archive tools
1415
run: sudo apt install zip
1516

16-
- uses: actions/checkout@v2
17+
- name: Checkout source code
18+
uses: actions/checkout@v2
1719
with:
1820
fetch-depth: 0
19-
ref: ${{ github.ref }}
20-
- uses: pnpm/[email protected]
21+
ref: ${{ github.event.repository.default_branch }}
22+
23+
- name: Install pnpm
24+
uses: pnpm/[email protected]
2125
with:
2226
version: 6.20.3
2327

28+
- name: Get variables
29+
id: get_vars
30+
run: |
31+
echo '::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)'
32+
echo '::set-output name=DATE::$(date +'%D')'
33+
2434
- name: Setup node
2535
uses: actions/setup-node@v2
2636
with:
2737
node-version: 16.x
2838
cache: 'pnpm'
29-
30-
- name: Set env
31-
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
39+
cache-dependency-path: 'pnpm-lock.yaml'
3240

3341
- name: Install dependencies
3442
run: pnpm i
3543

3644
- name: Run build
3745
run: pnpm build
3846

47+
- name: Bump manifest version
48+
run: node .github/actions/bump-manifest-version.js
49+
env:
50+
TGT_RELEASE_VERSION: ${{ github.ref_name }}
51+
52+
- name: Push manifest change
53+
uses: EndBug/add-and-commit@v8
54+
with:
55+
add: fxmanifest.lua
56+
push: true
57+
author_name: Manifest Bumper
58+
author_email: 41898282+github-actions[bot]@users.noreply.github.com
59+
message: 'chore: bump manifest version to ${{ github.ref_name }}'
60+
61+
- name: Update tag ref
62+
uses: EndBug/latest-tag@latest
63+
with:
64+
tag-name: ${{ github.ref_name }}
65+
3966
- name: Bundle files
4067
run: |
4168
mkdir -p ./temp/oxmysql
@@ -52,7 +79,7 @@ jobs:
5279
id: auto_release
5380
with:
5481
repo_token: '${{ secrets.GITHUB_TOKEN }}'
55-
title: ${{ env.RELEASE_VERSION }}
82+
title: '${{ env.RELEASE_VERSION }}'
5683
prerelease: false
5784
files: oxmysql.zip
5885

0 commit comments

Comments
 (0)