From 8280eeccb25609e328b09600530caec4555c0b5d Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sun, 31 Aug 2025 19:44:25 +0200 Subject: [PATCH 1/5] add nightly release CI --- .github/workflows/nightly_release.yml | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/nightly_release.yml diff --git a/.github/workflows/nightly_release.yml b/.github/workflows/nightly_release.yml new file mode 100644 index 0000000..cbee779 --- /dev/null +++ b/.github/workflows/nightly_release.yml @@ -0,0 +1,56 @@ +# Inspired from https://github.com/WerWolv/ImHex/blob/16dc199431858de984fb0ed3b50d60a9a9e511b1/.github/workflows/nightly_release.yml + +name: Nightly Release + +on: + push: + branches: + - main + workflow_dispatch: + +env: + NIGHTLY_TAG: nightly + +jobs: + nightly-release: + runs-on: ubuntu-24.04 + name: 🌃 Update Nightly Release + permissions: + contents: write + + steps: + - name: 🧰 Checkout + uses: actions/checkout@v4 + with: + path: project + fetch-depth: 0 + fetch-tags: true + + - name: ⬇️ Download artifacts from latest workflow + uses: dawidd6/action-download-artifact@v6 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: ci.yml + branch: ${{ github.event.release.target_commitish }} + workflow_conclusion: success + + - name: 📦 Update Pre-Release + run: | + set -e + + cd project + + # Move nightly tag to latest commit + git tag -f $NIGHTLY_TAG HEAD + git push origin $NIGHTLY_TAG --force + + # Auth for GitHub CLI + echo "${{ github.token }}" | gh auth login --with-token + + # Delete existing assets + for asset in $(gh release view $NIGHTLY_TAG --json assets --jq '.assets[].name'); do + gh release delete-asset $NIGHTLY_TAG "$asset" --yes + done + + # Upload new assets + gh release upload $NIGHTLY_TAG ../*.* --clobber From 6eee38606362db7a0f453c7b250dc4fab82c7c8d Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sun, 31 Aug 2025 19:45:33 +0200 Subject: [PATCH 2/5] allow cli to be built as single-file executable --- cli/package.json | 2 +- cli/src/index.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cli/package.json b/cli/package.json index ba0240a..5e589aa 100644 --- a/cli/package.json +++ b/cli/package.json @@ -11,7 +11,7 @@ "pino-pretty": "^13.0.0" }, "scripts": { - "build": "(cd ../mclib && bun run build) && bun build src/index.ts --outdir dist --minify --target node", + "build": "(cd ../mclib && bun run build) && bun build src/index.ts --outfile dist/modpackresolver-cli --compile", "start": "(cd ../mclib && bun run build) && bun src/index.ts", "lint": "eslint .", "opt:proxy": "HTTP_PROXY=http://127.0.0.1:8080 HTTPS_PROXY=http://127.0.0.1:8080" diff --git a/cli/src/index.ts b/cli/src/index.ts index a187461..6fd5aef 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -268,4 +268,11 @@ program } }); + +// Workaround. See https://github.com/oven-sh/bun/issues/22283 +if (process.argv.length >= 3) { + if (process.argv[2].endsWith('modpackresolver-cli')) { + process.argv.splice(2, 1); // remove argv[2] + } +} program.parse(process.argv); From bf787cdd003a563d65db49929a64ba080a640cf0 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sun, 31 Aug 2025 19:48:07 +0200 Subject: [PATCH 3/5] upload CLI artifact --- .github/workflows/ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2470499..90e6dbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: check: - name: Check code + name: Check and Build code runs-on: ubuntu-latest steps: - name: Checkout @@ -24,18 +24,21 @@ jobs: run: bun run lint - name: Build all - run: bun run build - - - name: Build website env: + # For website BACKEND_URL: https://backend-modpackresolver.itrooz.fr - run: cd web && bun run build + run: bun run build - name: Upload website artifact uses: actions/upload-pages-artifact@v3 with: path: 'web/build/' + - name: Upload CLI artifact + uses: actions/upload-artifact@v4 + with: + path: 'cli/dist/*' + build-backend-image: name: Build backend image runs-on: ubuntu-latest From a9f7c3d0cba18ab8d1f90a9b8ec10f8c3a57cee1 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sun, 31 Aug 2025 19:52:59 +0200 Subject: [PATCH 4/5] fix: correct CLI artifact upload name in CI workflow --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90e6dbc..075d995 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: - name: Upload CLI artifact uses: actions/upload-artifact@v4 with: + name: modpackresolver-cli path: 'cli/dist/*' build-backend-image: From ed8100494e030b5cb743842e42f858dc05174004 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sun, 31 Aug 2025 20:13:51 +0200 Subject: [PATCH 5/5] explicitely import pino-pretty --- cli/src/index.ts | 9 ++------- mclib/src/logger.ts | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/cli/src/index.ts b/cli/src/index.ts index 6fd5aef..e4bcb4d 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -4,6 +4,7 @@ import { program, Option } from '@commander-js/extra-typings'; import { CurseForgeRepository, LocalSolutionFinder, LoggerConfig, ModLoader, ModrinthRepository, LogLevel, Constraints, Solution, ModMetadata, RepositoryUtil, ModRepositoryName, RemoteModQueryService, IModQueryService, IRepository, LocalModQueryService } from 'mclib'; import { readFileSync } from 'fs'; import pino from 'pino'; +import pinoPretty from 'pino-pretty'; // Logging setup const LOG_LEVEL = (process.env.LOG_LEVEL ?? "info") as LogLevel; @@ -11,14 +12,8 @@ const logger = pino({ level: LOG_LEVEL, base: { pid: false, - }, - transport: { - target: 'pino-pretty', - options: { - colorize: true - } } -}); +}, pinoPretty()); LoggerConfig.setLevel(LOG_LEVEL); // Fetch wrapper to log timing and errors diff --git a/mclib/src/logger.ts b/mclib/src/logger.ts index 87c01a6..36023d4 100644 --- a/mclib/src/logger.ts +++ b/mclib/src/logger.ts @@ -1,4 +1,5 @@ import pino from 'pino'; +import pinoPretty from 'pino-pretty'; export enum LogLevel { Fatal = 'fatal', @@ -13,14 +14,8 @@ const logger = pino({ level: 'info', // default level base: { pid: false, - }, - transport: { - target: 'pino-pretty', - options: { - colorize: true - } } -}); +}, pinoPretty()); class LoggerConfig { static setLevel(level: LogLevel): void {