Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
check:
name: Check code
name: Check and Build code
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -24,18 +24,22 @@ 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:
name: modpackresolver-cli
path: 'cli/dist/*'

build-backend-image:
name: Build backend image
runs-on: ubuntu-latest
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/nightly_release.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 9 additions & 7 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@ 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;
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
Expand Down Expand Up @@ -268,4 +263,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);
9 changes: 2 additions & 7 deletions mclib/src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pino from 'pino';
import pinoPretty from 'pino-pretty';

export enum LogLevel {
Fatal = 'fatal',
Expand All @@ -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 {
Expand Down