测试自动构建

pull/1/head
masnn 5 years ago
parent 06f1b5bc62
commit 9cb68397b9

@ -0,0 +1,53 @@
name: DockerBuild
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node_version: '13.x'
- run: |
yarn
yarn add webpack webpack-cli -D
yarn build
- uses: actions/upload-artifact@v1
with:
name: hydro
path: dist
- run: |
cd ui
yarn
yarn add webpack webpack-cli -D
yarn build
cd ..
- uses: actions/upload-artifact@v1
with:
name: .uibuild
path: .uibuild
- run: |
yarn add pkg -D
yarn run pack
- uses: actions/upload-artifact@v1
with:
name: Hydro_linux_amd64
path: hydro-linux
- uses: actions/upload-artifact@v1
with:
name: Hydro_macos_amd64
path: hydro-macos
- uses: actions/upload-artifact@v1
with:
name: Hydro_win_amd64.exe
path: hydro-win.exe
- uses: elgohr/Publish-Docker-Github-Action@master
with:
name: hydrooj/hydro:alpine
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: Dockerfile

3
.gitignore vendored

@ -5,4 +5,5 @@ __*
ui/misc/.iconfont
ui/static/locale
.webpackStats.json
.cache
.cache
dist/

@ -0,0 +1,7 @@
FROM mhart/alpine-node:slim-10
WORKDIR /app
ADD .uibuild dist locales templates /app/
RUN mkdir /config
VOLUME [ "/config" ]
EXPOSE 8888
CMD ["node", "dist/development.js"]

@ -0,0 +1,16 @@
version: '3'
services:
hydro:
image: hydrooj/hydro:latest
restart: always
links:
- mongo
volumes:
- ./config.yaml:/config/config.yaml
ports:
- 8888:8888
mongo:
image: mongo:latest
restart: always
volumes:
- ./db:/data/db

@ -5,7 +5,7 @@ const
builtin = require('./model/builtin'),
pwhash = require('./lib/pwhash'),
options = require('./options'),
{ udoc } = require('../interfaces');
{ udoc } = require('./interface');
async function run() {
let mongourl = 'mongodb://';

@ -1,4 +1,3 @@
const { ObjectID } = require('bson');
exports.udoc = {
_id: 0,
mail: '',

@ -1,8 +1,9 @@
const
yaml = require('js-yaml'),
{ defaultsDeep } = require('lodash'),
fs = require('fs'),
path = require('path');
os = require('os'),
path = require('path'),
yaml = require('js-yaml'),
{ defaultsDeep } = require('lodash');
let options = {
db: {
@ -46,9 +47,12 @@ let options = {
};
try {
let t = yaml.safeLoad(fs.readFileSync(path.resolve(process.cwd(), 'config.yaml')));
let f = path.resolve(process.cwd(), 'config.yaml');
if (!fs.existsSync(f)) f = path.resolve(os.homedir(), '.config', 'hydro', 'config.yaml');
if (!fs.existsSync(f)) f = path.resolve('/config/config.yaml');
let t = yaml.safeLoad(fs.readFileSync(f));
options = defaultsDeep(t, options);
} catch (e) {
console.error('Cannot load config');
}
module.exports = options;
module.exports = options;

@ -1,10 +1,10 @@
{
"name": "hydrofrontend",
"name": "hydro",
"version": "0.0.0",
"main": "vj5/development.js",
"repository": "https://github.com/masnn/vj5.git",
"main": "hydro/development.js",
"repository": "https://github.com/hydro-dev/Hydro.git",
"author": "masnn",
"license": "MIT",
"license": "GPL-3.0-only",
"dependencies": {
"axios": "^0.19.0",
"bson": "^4.0.2",
@ -25,5 +25,23 @@
},
"devDependencies": {
"eslint": "^6.6.0"
},
"scripts": {
"build": "webpack --config webpack.config.js",
"pack": "pkg .",
"lint": "eslint judger --fix"
},
"pkg": {
"scripts": [
"hydro/**.js"
],
"assets": [
".uibuild/*",
"locales/*",
"templates/*"
]
},
"bin": {
"judger": "hydro/development.js"
}
}
}

@ -0,0 +1,16 @@
const config = {
mode: 'production',
entry: {
development: './hydro/development.js',
install: './hydro/install.js',
uninstall: './hydro/uninstall.js'
},
output: {
filename: '[name].js',
path: __dirname + '/dist'
},
target: 'node',
module: {}
};
module.exports = config;
Loading…
Cancel
Save