Skip to content

Commit

Permalink
added: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
scolastico committed Oct 25, 2024
1 parent 30136a2 commit 8fa70ed
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
# Environment setup
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install pnpm
run: npm i -g pnpm
- name: Replace version in package.json to be semver compatible
if: github.event_name == 'release'
run: sed -i "s/IN-DEV/$(echo $GITHUB_REF | sed 's/refs\/tags\///')/" package.json

# Install dependencies
- name: Install dependencies with pnpm
run: pnpm install

# Build and generate code
- name: Build
run: pnpm build

# Upload artifacts to GitHub and NPM
- name: Upload build to artifacts
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: build
path: dist
- name: Get repository slug
if: github.event_name == 'release'
id: repo_slug
run: echo "REPO_SLUG=$(basename $GITHUB_REPOSITORY)" >> $GITHUB_OUTPUT
- name: Upload build to release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
overwrite: true
file: dist/index.cjs
repo_token: ${{ secrets.GITHUB_TOKEN }}
asset_name: server.cjs
tag: ${{ github.ref }}
- name: Publish package on NPM
if: github.event_name == 'release'
run: pnpm publish . --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "server",
"version": "1.0.0",
"version": "IN-DEV",
"source": "src/index.ts",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion src/PluginManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class PluginManager {
return;
}
this.log.debug('Enabling plugin ' + p.plugin.name);
if (!semver.satisfies(this.serverVersion, p.plugin.serverVersion)) {
if (this.serverVersion !== 'IN-DEV' && !semver.satisfies(this.serverVersion, p.plugin.serverVersion)) {
this.log.warn('Plugin ' + p.plugin.name + ' requires server version ' + p.plugin.serverVersion);
return;
}
Expand Down

0 comments on commit 8fa70ed

Please sign in to comment.