Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| daf3630b58 |
10
.env.default
Normal file
10
.env.default
Normal file
@@ -0,0 +1,10 @@
|
||||
PROJECT=puzzlez
|
||||
SDK_PATH=$HOME/sdk
|
||||
PUBLISH_PATH=$HOME/public/$PROJECT
|
||||
BUILD_PATH=./build
|
||||
TARGET_PATH=./target
|
||||
KEY_STORE=<keystore.jks>
|
||||
KEY_PASS=<passphrase>
|
||||
REPO=https://git.shmyga.ru/api/packages/InfernalGames
|
||||
PUBLISH_USER=<username>
|
||||
PUBLISH_PASSWORD=<passphrase>
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -14,3 +14,4 @@ config.json
|
||||
/log
|
||||
/ansible/*.retry
|
||||
.npmrc
|
||||
.env
|
||||
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
FROM ubuntu:noble AS base
|
||||
RUN apt update && apt install -y \
|
||||
nodejs \
|
||||
npm \
|
||||
openjdk-11-jre \
|
||||
protobuf-compiler \
|
||||
jq
|
||||
RUN node -v
|
||||
RUN npm -v
|
||||
|
||||
FROM base AS builder
|
||||
ENV GRADLE_USER_HOME=/sdk/gradle
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY gulpfile.js protohx.json ./
|
||||
COPY tasks ./tasks
|
||||
COPY config.example.json ./config.example.json
|
||||
RUN --mount=type=secret,id=KEY_STORE \
|
||||
cat /run/secrets/KEY_STORE > ./key.jks
|
||||
RUN --mount=type=secret,id=KEY_PASS,env=KEY_PASS \
|
||||
jq --arg key_pass "$KEY_PASS" \
|
||||
'.SdkDir = "/sdk" | .PublishDir = "/app/publish" | .Key.store = "key.jks" | .Key.pass = $key_pass' \
|
||||
config.example.json > config.json
|
||||
COPY src ./src
|
||||
COPY dependencies ./dependencies
|
||||
VOLUME ["/sdk", "/app/build", "/app/target", "/app/publish", "/app/src-gen"]
|
||||
CMD ["npx", "gulp", "default"]
|
||||
15
README.md
15
README.md
@@ -1,10 +1,9 @@
|
||||
`.bashrc`
|
||||
```bash
|
||||
export NEKO_VERSION="2.2.0"
|
||||
export HAXE_VERSION="4.2.5"
|
||||
# Puzzlez
|
||||
|
||||
export NEKO_SDK="$HOME/sdk/neko/$NEKO_VERSION"
|
||||
export HAXE_SDK="$HOME/sdk/haxe/$HAXE_VERSION"
|
||||
## Play
|
||||
|
||||
alias haxe-activate=". $NEKO_SDK/activate && . $HAXE_SDK/activate"
|
||||
```
|
||||
https://shmyga.ru/puzzlez/html5/index.html
|
||||
|
||||
## Packages
|
||||
|
||||
https://git.shmyga.ru/InfernalGames/-/packages/generic/puzzlez
|
||||
|
||||
22
docker-compose.yaml
Normal file
22
docker-compose.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
name: $PROJECT
|
||||
services:
|
||||
builder:
|
||||
container_name: $PROJECT-builder
|
||||
image: infernal-games/$PROJECT-builder
|
||||
build:
|
||||
context: .
|
||||
secrets:
|
||||
- KEY_STORE
|
||||
- KEY_PASS
|
||||
volumes:
|
||||
- ${SDK_PATH}:/sdk
|
||||
- ${BUILD_PATH}:/app/build
|
||||
- ${TARGET_PATH}:/app/target
|
||||
- ${PUBLISH_PATH}:/app/publish
|
||||
- ./src-gen:/app/src-gen
|
||||
|
||||
secrets:
|
||||
KEY_STORE:
|
||||
file: $KEY_STORE
|
||||
KEY_PASS:
|
||||
environment: KEY_PASS
|
||||
130
gulpfile.js
130
gulpfile.js
@@ -1,11 +1,10 @@
|
||||
const gulp = require('gulp');
|
||||
const gulpClean = require('gulp-clean');
|
||||
const Config = require('./config.json');
|
||||
const packageInfo = require('./package.json');
|
||||
const {System, Sdk, Haxe, Project} = require('gulp-haxetool');
|
||||
const dateformat = require('dateformat');
|
||||
const argv = require('yargs').argv;
|
||||
const publish = require('./tasks/gulp-publish');
|
||||
const gulp = require("gulp");
|
||||
const gulpClean = require("gulp-clean");
|
||||
const Config = require("./config.json");
|
||||
const packageInfo = require("./package.json");
|
||||
const { System, Sdk, Haxe, Project } = require("gulp-haxetool");
|
||||
const dateformat = require("dateformat");
|
||||
const publish = require("./tasks/gulp-publish");
|
||||
|
||||
if (packageInfo.haxe) {
|
||||
Haxe.VERSION = packageInfo.haxe;
|
||||
@@ -20,37 +19,48 @@ if (Config.BuildDir) {
|
||||
}
|
||||
|
||||
exports.clean = function clean() {
|
||||
return gulp.src('target/*', {read: false}).pipe(gulpClean());
|
||||
return gulp.src("target/*", { read: false }).pipe(gulpClean());
|
||||
};
|
||||
|
||||
exports.setup = function setup() {
|
||||
const builder = Project.Builder.new(
|
||||
app.config,
|
||||
Project.Platform.ANDROID,
|
||||
app.buildSystem,
|
||||
);
|
||||
return builder.prepare();
|
||||
};
|
||||
|
||||
exports.generate = function generate() {
|
||||
return new Haxe().haxelib(['run', 'protohx', 'generate', 'protohx.json']).then(({stdout}) => {
|
||||
if (stdout.indexOf('FAIL') > -1) {
|
||||
return exports.setup().then(() =>
|
||||
new Haxe()
|
||||
.haxelib(["run", "protohx", "generate", "protohx.json"])
|
||||
.then(({ stdout }) => {
|
||||
if (stdout.indexOf("FAIL") > -1) {
|
||||
throw stdout;
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
const config = new Project.Config({
|
||||
meta: {
|
||||
title: 'Puzzle\'z',
|
||||
filename: 'puzzlez',
|
||||
icon: 'src/app/resources/icon.png',
|
||||
pack: 'ru.m.puzzlez',
|
||||
author: 'shmyga <shmyga.z@gmail.com>',
|
||||
company: 'MegaLoMania',
|
||||
version: packageInfo.version + (Config.Develop ? '-SNAPSHOT' : ''),
|
||||
title: "Puzzle'z",
|
||||
filename: "puzzlez",
|
||||
icon: "src/app/resources/icon.png",
|
||||
pack: "ru.m.puzzlez",
|
||||
author: "shmyga <shmyga.z@gmail.com>",
|
||||
company: "MegaLoMania",
|
||||
version: packageInfo.version + (Config.Develop ? "-SNAPSHOT" : ""),
|
||||
},
|
||||
key: Config.Key,
|
||||
libs: packageInfo.haxeDependencies,
|
||||
macros: [
|
||||
`CompilationOption.set('build','${dateformat(new Date(), 'yyyy-mm-dd HH:MM:ss')}')`,
|
||||
`CompilationOption.set('build','${dateformat(new Date(), "yyyy-mm-dd HH:MM:ss")}')`,
|
||||
`CompilationOption.set('UNSPLASH_KEY','${Config.UnsplashKey}')`,
|
||||
`CompilationOption.set('PIXABAY_KEY','${Config.PixabayKey}')`,
|
||||
],
|
||||
flags: [
|
||||
'proto_debug',
|
||||
]
|
||||
flags: ["proto_debug"],
|
||||
});
|
||||
|
||||
const app = new Project(
|
||||
@@ -63,77 +73,67 @@ const app = new Project(
|
||||
Project.Platform.ANDROID,
|
||||
],
|
||||
config.branch({
|
||||
name: 'app',
|
||||
sources: [
|
||||
'src-gen/haxe',
|
||||
'src/common/haxe',
|
||||
'src/app/haxe',
|
||||
name: "app",
|
||||
sources: ["src-gen/haxe", "src/common/haxe", "src/app/haxe"],
|
||||
android: [
|
||||
{
|
||||
path: "dependencies/android",
|
||||
extensions: ["ru.m.android.FileUtil"],
|
||||
},
|
||||
],
|
||||
android: [{
|
||||
path: 'dependencies/android',
|
||||
extensions: ['ru.m.android.FileUtil'],
|
||||
}],
|
||||
assets: [
|
||||
'src/app/resources',
|
||||
],
|
||||
main: 'ru.m.puzzlez.PuzzlezApp',
|
||||
assets: ["src/app/resources"],
|
||||
main: "ru.m.puzzlez.PuzzlezApp",
|
||||
meta: {
|
||||
width: 1280,
|
||||
height: 768,
|
||||
},
|
||||
flags: [
|
||||
'app',
|
||||
]
|
||||
flags: ["app"],
|
||||
}),
|
||||
).bind(module, gulp);
|
||||
|
||||
const server = new Project(
|
||||
Project.BuildSystem.HAXE,
|
||||
[
|
||||
Project.Platform.NEKO,
|
||||
Project.Platform.CPP,
|
||||
],
|
||||
[Project.Platform.NEKO, Project.Platform.CPP],
|
||||
config.branch({
|
||||
name: 'server',
|
||||
sources: [
|
||||
'src-gen/haxe',
|
||||
'src/common/haxe',
|
||||
'src/server/haxe',
|
||||
],
|
||||
main: 'ru.m.puzzlez.PuzzlezServer',
|
||||
})
|
||||
name: "server",
|
||||
sources: ["src-gen/haxe", "src/common/haxe", "src/server/haxe"],
|
||||
main: "ru.m.puzzlez.PuzzlezServer",
|
||||
}),
|
||||
).bind(module, gulp);
|
||||
|
||||
module.exports.publish = publish(packageInfo.name, packageInfo.version, Config.PublishDir, Config.PublishUrl);
|
||||
module.exports.publish = publish(
|
||||
packageInfo.name,
|
||||
packageInfo.version,
|
||||
Config.PublishDir,
|
||||
Config.PublishUrl,
|
||||
);
|
||||
|
||||
const defaultSeries = [
|
||||
exports.clean,
|
||||
exports.generate,
|
||||
module.exports['app:flash:build'],
|
||||
module.exports['app:flash:html'],
|
||||
module.exports['app:html5:build'],
|
||||
module.exports["app:flash:build"],
|
||||
module.exports["app:flash:html"],
|
||||
module.exports["app:html5:build"],
|
||||
];
|
||||
|
||||
if (System.isLinux) {
|
||||
defaultSeries.push(
|
||||
module.exports['app:linux:build'],
|
||||
module.exports['app:linux:archive'],
|
||||
module.exports['app:linux:deb'],
|
||||
module.exports["app:linux:build"],
|
||||
module.exports["app:linux:archive"],
|
||||
module.exports["app:linux:deb"],
|
||||
|
||||
module.exports['app:android:build'],
|
||||
module.exports["app:android:build"],
|
||||
);
|
||||
}
|
||||
|
||||
if (System.isWindows) {
|
||||
defaultSeries.push(
|
||||
module.exports['app:windows:build'],
|
||||
module.exports['app:windows:archive'],
|
||||
module.exports['app:windows:installer'],
|
||||
module.exports["app:windows:build"],
|
||||
module.exports["app:windows:archive"],
|
||||
module.exports["app:windows:installer"],
|
||||
);
|
||||
}
|
||||
|
||||
defaultSeries.push(
|
||||
exports.publish,
|
||||
);
|
||||
defaultSeries.push(exports.publish);
|
||||
|
||||
module.exports.default = gulp.series(defaultSeries);
|
||||
|
||||
7
scripts/build
Executable file
7
scripts/build
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname $(dirname "$0"))" || exit
|
||||
|
||||
source .env
|
||||
mkdir -p "$SDK_PATH" "$PUBLISH_PATH" "$BUILD_PATH" "$TARGET_PATH" "src-gen"
|
||||
docker compose run --rm --user $(id -u):$(id -g) --build --remove-orphans builder
|
||||
32
scripts/publish
Executable file
32
scripts/publish
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname $(dirname "$0"))" || exit
|
||||
source .env
|
||||
|
||||
VERSION=$(grep -m 1 'version' ./package.json | grep -oP '"version"\s*:\s*"\K\d+\.\d+\.\d+')
|
||||
|
||||
curl --user "${PUBLISH_USER}:${PUBLISH_PASSWORD}" -X DELETE \
|
||||
"${REPO}/generic/${PROJECT}/${VERSION}"
|
||||
|
||||
PACKAGES=(
|
||||
"android/${PROJECT}_${VERSION}.apk"
|
||||
"debian/${PROJECT}_${VERSION}_all.deb"
|
||||
"archive/${PROJECT}_${VERSION}_linux.tar.gz"
|
||||
)
|
||||
|
||||
for PACKAGE in "${PACKAGES[@]}"
|
||||
do
|
||||
PACKAGE_NAME=$(basename "$PACKAGE")
|
||||
echo "publish: $PACKAGE"
|
||||
curl --user "${PUBLISH_USER}:${PUBLISH_PASSWORD}" \
|
||||
--upload-file "${PUBLISH_PATH}/${PACKAGE}" \
|
||||
"${REPO}/generic/${PROJECT}/${VERSION}/${PACKAGE_NAME}"
|
||||
|
||||
if [[ "$PACKAGE" == *.deb ]]; then
|
||||
curl --user "${PUBLISH_USER}:${PUBLISH_PASSWORD}" -X DELETE \
|
||||
"${REPO}/debian/pool/noble/main/${PROJECT}/${VERSION}/all"
|
||||
curl --user "${PUBLISH_USER}:${PUBLISH_PASSWORD}" \
|
||||
--upload-file "${PUBLISH_PATH}/${PACKAGE}" \
|
||||
"${REPO}/debian/pool/noble/main/upload"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user