From 9ec30d8f6acfa1522cb478bdc40ef86a287c3e36 Mon Sep 17 00:00:00 2001 From: tabarra <1808295+tabarra@users.noreply.github.com> Date: Fri, 14 Jun 2024 22:58:43 -0300 Subject: [PATCH 1/4] ci: added pre-commit hook to block commits with the !NC flag --- .husky/pre-commit | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 000000000..40f8a7825 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,13 @@ +#!/bin/sh + +# Rejects commits with the !NC flag is present in the changes +# The !NC flag is used to mark code that should not be commited to the repository +# It's useful to avoid commiting debug code, test code, etc. + +# Check if the !NC flag is present in the changes +if git diff --staged --unified=0 --no-color | grep '^+' | grep -q '!NC'; then + echo -e "COMMIT REJECTED: Found the !NC flag in your changes.\nMake sure you didn't accidently staged something you shouldn't!" + exit 1 +fi + +exit 0 From 97b89bdf64641c0f22f78f574a9ef8158cd56f80 Mon Sep 17 00:00:00 2001 From: tabarra <1808295+tabarra@users.noreply.github.com> Date: Sun, 16 Jun 2024 06:18:16 -0300 Subject: [PATCH 2/4] ci: improved build step --- .github/workflows/build-prerelease.yml | 45 ------- .github/workflows/build-prod.yml | 45 ------- .github/workflows/publish-tagged.yml | 54 ++++++++ .gitignore | 1 + core/package.json | 1 - fxmanifest.lua | 2 +- package-lock.json | 164 ++++++------------------- package.json | 3 +- scripts/main-builder.js | 94 +++++++++----- 9 files changed, 158 insertions(+), 251 deletions(-) delete mode 100644 .github/workflows/build-prerelease.yml delete mode 100644 .github/workflows/build-prod.yml create mode 100644 .github/workflows/publish-tagged.yml diff --git a/.github/workflows/build-prerelease.yml b/.github/workflows/build-prerelease.yml deleted file mode 100644 index de5c9c059..000000000 --- a/.github/workflows/build-prerelease.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Create Tagged Pre-Release - -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+-**" - -jobs: - build: - name: "Build Changelog & Pre-Release" - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] - - steps: - # We fetch to 0 so we can collect the commits - # since last update - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.ref }} - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Download all modules - run: npm ci - - - name: Build Pre-Release project - run: TX_PRERELEASE_BUILD=true npm run build - - - name: Compress build output with zip - run: | - cd dist && zip -r ../monitor.zip . - - - name: Create and Upload Pre-Release - uses: "marvinpinto/action-automatic-releases@v1.2.1" - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - prerelease: true - files: monitor.zip diff --git a/.github/workflows/build-prod.yml b/.github/workflows/build-prod.yml deleted file mode 100644 index 0c64d6659..000000000 --- a/.github/workflows/build-prod.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Create Tagged Release Prod - -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" - -jobs: - build: - name: "Build Changelog & Release Prod" - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] - - steps: - # We fetch to 0 so we can collect the commits - # since last update - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.ref }} - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: Download all modules - run: npm ci - - - name: Build project - run: npm run build - - - name: Compress build output with zip - run: | - cd dist && zip -r ../monitor.zip . - - - name: Create and Upload Release - uses: "marvinpinto/action-automatic-releases@v1.2.1" - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - prerelease: false - files: monitor.zip diff --git a/.github/workflows/publish-tagged.yml b/.github/workflows/publish-tagged.yml new file mode 100644 index 000000000..80886cf75 --- /dev/null +++ b/.github/workflows/publish-tagged.yml @@ -0,0 +1,54 @@ +name: Publish Tagged Build + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" + +jobs: + build: + name: "Build Changelog & Release Prod" + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + attestations: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Download all modules + run: npm ci + + - name: Build project + run: | + npm run build + cat .github/.cienv >> $GITHUB_ENV + + - name: Compress build output with zip + run: | + cd dist + zip -r ../monitor.zip . + cd .. + sha256sum monitor.zip + + - name: Attest build provenance + id: attest_build_provenance + uses: actions/attest-build-provenance@v1 + with: + subject-path: monitor.zip + + - name: Create and Upload Release + uses: "marvinpinto/action-automatic-releases@v1.2.1" + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + prerelease: ${{ env.TX_IS_PRERELEASE }} + files: monitor.zip diff --git a/.gitignore b/.gitignore index 05652f9b5..cca1a8707 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ tmp_core_tsc/* /start_*.bat monitor-*.zip bundle_size_report.html +.github/.cienv # IDE Specific .idea diff --git a/core/package.json b/core/package.json index ea5937499..913b7d4ab 100644 --- a/core/package.json +++ b/core/package.json @@ -53,7 +53,6 @@ "pidtree": "^0.6.0", "pidusage": "^3.0.2", "rotating-file-stream": "^3.2.1", - "semver": "^7.6.0", "slash": "^5.1.0", "slug": "^8.2.3", "socket.io": "^4.7.5", diff --git a/fxmanifest.lua b/fxmanifest.lua index 550286efc..29b604095 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -5,7 +5,7 @@ author 'Tabarra' description 'The official FiveM/RedM server web/in-game management platform.' repository 'https://github.com/tabarra/txAdmin' -version '7.2.2' +version 'REPLACE-VERSION' ui_label 'txAdmin' rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.' diff --git a/package-lock.json b/package-lock.json index 0db603cac..0156570f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,8 @@ "dependencies": { "chalk": "^5.3.0", "humanize-duration": "^3.31.0", - "lodash-es": "^4.17.21" + "lodash-es": "^4.17.21", + "semver": "^7.6.2" }, "devDependencies": { "@commitlint/cli": "^18.4.4", @@ -74,7 +75,6 @@ "pidtree": "^0.6.0", "pidusage": "^3.0.2", "rotating-file-stream": "^3.2.1", - "semver": "^7.6.0", "slash": "^5.1.0", "slug": "^8.2.3", "socket.io": "^4.7.5", @@ -241,18 +241,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "core/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "core/node_modules/mimic-fn": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", @@ -342,21 +330,6 @@ "fsevents": "~2.3.2" } }, - "core/node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "core/node_modules/signal-exit": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", @@ -880,6 +853,35 @@ "node": ">=v18" } }, + "node_modules/@commitlint/is-ignored/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@commitlint/is-ignored/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@commitlint/lint": { "version": "18.4.4", "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-18.4.4.tgz", @@ -5470,33 +5472,6 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/parser": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.7.0.tgz", @@ -5619,18 +5594,6 @@ "balanced-match": "^1.0.0" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { "version": "9.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", @@ -5646,21 +5609,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/utils": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.7.0.tgz", @@ -5686,33 +5634,6 @@ "eslint": "^8.56.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/visitor-keys": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.0.tgz", @@ -14660,13 +14581,10 @@ } }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -14674,18 +14592,6 @@ "node": ">=10" } }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/seq-queue": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", diff --git a/package.json b/package.json index 982d0a6d3..be22a105a 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "dependencies": { "chalk": "^5.3.0", "humanize-duration": "^3.31.0", - "lodash-es": "^4.17.21" + "lodash-es": "^4.17.21", + "semver": "^7.6.2" }, "devDependencies": { "@commitlint/cli": "^18.4.4", diff --git a/scripts/main-builder.js b/scripts/main-builder.js index a847ca2e7..65aabf9ad 100644 --- a/scripts/main-builder.js +++ b/scripts/main-builder.js @@ -1,6 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import child_process from 'node:child_process'; +import { SemVer } from 'semver'; import chokidar from 'chokidar'; import debounce from 'lodash/debounce.js'; import esbuild from 'esbuild'; @@ -12,33 +13,69 @@ const txLicenseBannerFile = licenseBanner(); /** - * Gets the pre-release expiration const to be defined by esbuild. - * @returns false | timestamp + * Extracts the version from the GITHUB_REF env var and detects if pre-release */ -const getPreReleaseExpirationString = () => { - if (process?.env?.TX_PRERELEASE_BUILD === 'true') { - return new Date().setUTCHours(24 * config.preReleaseExpirationDays, 0, 0, 0).toString(); - } else { - return '0'; +const getPublishVersion = (isOptional) => { + const workflowRef = process.env.GITHUB_REF; + try { + if (!workflowRef) { + if (isOptional) { + return { + txVersion: '9.9.9-dev', + isPreRelease: false, + preReleaseExpiration: '0', + }; + } else { + throw new Error('No --tag found.'); + } + } + const refRemoved = workflowRef.replace(/^(refs\/tags\/)?v/, ''); + const parsedVersion = new SemVer(refRemoved); + const isPreRelease = parsedVersion.prerelease.length > 0; + const potentialExpiration = new Date().setUTCHours(24 * config.preReleaseExpirationDays, 0, 0, 0); + console.log(`txAdmin version ${parsedVersion.version}.`); + return { + txVersion: parsedVersion.version, + isPreRelease, + preReleaseExpiration: isPreRelease ? potentialExpiration.toString() : '0', + }; + } catch (error) { + console.error('Version setup failed: ' + error.message); + process.exit(1); } }; +/** + * Edits the ./dist/fxmanifest.lua to include the txAdmin version. + * TODO: set up *_scripts automagically + */ +const setupDistFxmanifest = (targetPath, txVersion) => { + console.log('[BUILDER] Setting up fxmanifest.lua: ' + txVersion); + const fxManifestPath = path.join(targetPath, 'fxmanifest.lua'); + let fxManifestContent = fs.readFileSync(fxManifestPath, 'utf8'); + fxManifestContent = fxManifestContent.replace(/^version 'REPLACE-VERSION'$/m, `version '${txVersion}'`); + fs.writeFileSync(fxManifestPath, fxManifestContent); +}; + + /** * Sync the files from local path to target path. * This function tried to remove the files before copying new ones, * therefore, first make sure the path is correct. * NOTE: each change, it resets the entire target path. * @param {String} targetPath + * @param {String} txVersion * @param {String} eventName */ -const copyStaticFiles = (targetPath, eventName) => { +const copyStaticFiles = (targetPath, txVersion, eventName) => { console.log(`[COPIER][${eventName}] Syncing ${targetPath}.`); for (const srcPath of config.copy) { const destPath = path.join(targetPath, srcPath); fs.rmSync(destPath, { recursive: true, force: true }); fs.cpSync(srcPath, destPath, { recursive: true }); } + setupDistFxmanifest(targetPath, txVersion); }; @@ -124,7 +161,7 @@ class txAdminRunner { /** * Development task, it will copy the files to target fxserver, build+bundle core, and watch for changes. */ -const runDevTask = async () => { +const runDevTask = async (txVersion, preReleaseExpiration) => { //Extract paths and validate them if (typeof process.env.TXADMIN_DEV_FXSERVER_PATH !== 'string') { console.error('process.env.TXADMIN_DEV_FXSERVER_PATH is not defined.'); @@ -142,16 +179,18 @@ const runDevTask = async () => { //Sync target path and start chokidar //We don't really care about the path, just remove everything and copy again - copyStaticFiles(monitorPath, 'init'); - const debouncedCopier = debounce(copyStaticFiles, config.debouncerInterval); + copyStaticFiles(monitorPath, txVersion, 'init'); + const debouncedCopier = debounce((eventName) => { + copyStaticFiles(monitorPath, txVersion, eventName); + }, config.debouncerInterval); const staticWatcher = chokidar.watch(config.copy, { // awaitWriteFinish: true, persistent: true, ignoreInitial: true, }); - staticWatcher.on('add', () => { debouncedCopier(monitorPath, 'add'); }); - staticWatcher.on('change', () => { debouncedCopier(monitorPath, 'change'); }); - staticWatcher.on('unlink', () => { debouncedCopier(monitorPath, 'unlink'); }); + staticWatcher.on('add', () => { debouncedCopier('add'); }); + staticWatcher.on('change', () => { debouncedCopier('change'); }); + staticWatcher.on('unlink', () => { debouncedCopier('unlink'); }); fs.writeFileSync(path.join(monitorPath, 'package.json'), '{"type":"commonjs"}'); //Create txAdmin process runner @@ -181,9 +220,7 @@ const runDevTask = async () => { platform: 'node', target: 'node16', charset: 'utf8', - define: { - TX_PRERELEASE_EXPIRATION: getPreReleaseExpirationString(), - } + define: { TX_PRERELEASE_EXPIRATION: preReleaseExpiration }, }; const plugins = [{ name: 'fxsRestarter', @@ -216,10 +253,10 @@ const runDevTask = async () => { /** * Main publish task, it will copy static files, transpile and build core */ -const runPublishTask = () => { +const runPublishTask = (txVersion, preReleaseExpiration) => { //Copy static files - console.log('Starting txAdmin Prod Builder.'); - copyStaticFiles('./dist/', 'publish'); + console.log('Starting txAdmin Prod Builder'); + copyStaticFiles('./dist/', txVersion, 'publish'); fs.writeFileSync('./dist/package.json', '{"type":"commonjs"}'); fs.writeFileSync('./dist/LICENSE.txt', txLicenseBannerFile); @@ -233,15 +270,11 @@ const runPublishTask = () => { target: 'node16', minifyWhitespace: true, charset: 'utf8', - define: { - TX_PRERELEASE_EXPIRATION: getPreReleaseExpirationString(), - }, - banner: { - js: txLicenseBannerComment, - }, + define: { TX_PRERELEASE_EXPIRATION: preReleaseExpiration }, + banner: { js: txLicenseBannerComment }, //To satisfy the license's "full text" requirement, it will be generated //by another npm script and it is referenced in the banner. - legalComments: 'none', + legalComments: 'none', }); if (errors.length) { console.log(`[BUNDLER] Failed with ${errors.length} errors.`); @@ -262,9 +295,12 @@ const runPublishTask = () => { const taskType = process.argv[2]; if (taskType === 'dev') { process.stdout.write('.\n'.repeat(80) + '\x1B[2J\x1B[H'); - runDevTask(); + const { txVersion, preReleaseExpiration } = getPublishVersion(true); + runDevTask(txVersion, preReleaseExpiration); } else if (taskType === 'publish') { - runPublishTask(); + const { txVersion, isPreRelease, preReleaseExpiration } = getPublishVersion(false); + fs.writeFileSync('.github/.cienv', `TX_IS_PRERELEASE=${isPreRelease}\n`); + runPublishTask(txVersion, preReleaseExpiration); } else { console.log('invalid task type'); process.exit(1); From 216e28a545875af232c605cbb181044039b0ff91 Mon Sep 17 00:00:00 2001 From: tabarra <1808295+tabarra@users.noreply.github.com> Date: Sun, 16 Jun 2024 06:48:30 -0300 Subject: [PATCH 3/4] ci: attempt to fix locale checking workflow --- .github/workflows/locale-pull-request.yml | 31 +++++++++++------------ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/locale-pull-request.yml b/.github/workflows/locale-pull-request.yml index efa7c280c..ef63c010f 100644 --- a/.github/workflows/locale-pull-request.yml +++ b/.github/workflows/locale-pull-request.yml @@ -10,24 +10,33 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write + steps: - name: Checkout code uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v3.8.1 + - name: Use Node.js 20 + uses: actions/setup-node@v4 with: - node-version: '20' + node-version: 20 - name: Install dependencies run: npm ci - name: Label PR and enforce base branch - uses: actions/github-script@v6.4.1 + uses: actions/github-script@v7 with: script: | - console.warn('This is bugged and doesn\'t work, skip this step for now!'); - process.exit(0); + // console.warn('This is bugged and doesn\'t work, skip this step for now!'); + // process.exit(0); + + // Add the 'translation' label + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['translation'] + }); console.log(JSON.stringify(context.payload.pull_request)); const { repo, owner } = context.repo; @@ -40,14 +49,6 @@ jobs: pull_number }); - // Add the 'translation' label - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['translation'] - }) - // Check if the base branch is 'main' or 'master' if (pull_request.data.base.ref === 'main' || pull_request.data.base.ref === 'master') { // Change the base branch to 'develop' @@ -58,8 +59,6 @@ jobs: base: 'develop' }); } - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Run locale:check id: locale-check From 08b56ea2f7242e25300276d59ac47e1272d7ec4c Mon Sep 17 00:00:00 2001 From: tabarra <1808295+tabarra@users.noreply.github.com> Date: Sun, 16 Jun 2024 06:49:59 -0300 Subject: [PATCH 4/4] tweak: messed with the pt locale --- locale/pt.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/pt.json b/locale/pt.json index 9902cadd0..5ed98c9be 100644 --- a/locale/pt.json +++ b/locale/pt.json @@ -1,6 +1,6 @@ { "$meta": { - "label": "Portuguese", + "label": "Portuguese1", "humanizer_language": "pt" }, "restarter": {