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
62 changes: 62 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
lint:
name: 'Lint code'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- run: npm install -g pnpm
- run: pnpm install --frozen-lockfile
- run: cp .env.example .env
- run: pnpm run build
- run: pnpm run lint
- run: pnpm run check

deploy:
name: Deploy
needs: lint
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: self-hosted

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24

- name: Copy env file
run: cp /opt/apps/FileManager/.env ./.env

- name: Install & Build
run: |
npm install -g pnpm
pnpm install --frozen-lockfile
pnpm run build

- name: Sync Files
run: |
rsync -av --delete ./ /opt/apps/FileManager/ \
--exclude .git \
--exclude node_modules \
--exclude .env \
--exclude "uploads/" \

- name: Restart Application
run: |
cd /opt/apps/FileManager
pnpm install
pnpm run migrate
sudo systemctl restart uploader
35 changes: 35 additions & 0 deletions migrations/20260316000000_folders.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*eslint-disable @typescript-eslint/no-explicit-any*/

import { Kysely, sql } from 'kysely';

export const up = async (conn: Kysely<any>) => {
// Create folders table
await conn.schema
.createTable('folders')
.addColumn('id', 'varchar(36)', (col) => col.primaryKey())
.addColumn('name', 'varchar(255)', (col) => col.notNull())
.addColumn('created_at', 'datetime', (col) =>
col.notNull().defaultTo(sql`CURRENT_TIMESTAMP`)
)
.addColumn('created_by', 'integer', (col) =>
col.notNull().references('users.id').onDelete('cascade')
)
.execute();

// Create folder_files junction table
await conn.schema
.createTable('folder_files')
.addColumn('folder_id', 'varchar(36)', (col) =>
col.notNull().references('folders.id').onDelete('cascade')
)
.addColumn('file_id', 'varchar(36)', (col) =>
col.notNull().references('files.id').onDelete('cascade')
)
.addPrimaryKeyConstraint('folder_files_pk', ['folder_id', 'file_id'])
.execute();
};

export const down = async (conn: Kysely<any>) => {
await conn.schema.dropTable('folder_files').execute();
await conn.schema.dropTable('folders').execute();
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@
},
"dependencies": {
"@patrick115/sveltekitapi": "^1.3.2",
"@types/tar-stream": "^3.1.4",
"bcrypt": "^6.0.0",
"dotenv": "^17.2.3",
"jsonwebtoken": "^9.0.3",
"kysely": "^0.28.9",
"mode-watcher": "^1.1.0",
"mysql2": "^3.15.3",
"sharp": "^0.34.5",
"tar-stream": "^3.1.8",
"uuid": "^13.0.0",
"zod": "^4.2.1"
}
Expand Down
Loading
Loading