diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a54e24a --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# IDE +.idea/ +.vs/ + +# Node Modules +node_modules/ +module/foundry.js +foundry.js +foundry_07.js +package-lock.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a862d65 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,114 @@ +stages: + - compile + - release + +# Compile Job (runs on every commit) +compile: + stage: compile + image: ubuntu:latest + before_script: + # Install Node.js v21.7.3 manually + - apt-get update && apt-get install -y curl + - curl -fsSL https://deb.nodesource.com/setup_21.x | bash - + - apt-get install -y nodejs + - node -v # Verify the correct Node.js version + # Install Gulp globally + - npm install --global gulp-cli + - gulp --version # Verify Gulp is installed + script: + - npm install + - gulp compile + only: + - branches + +# Release Job (manually triggered with version) +release: + stage: release + image: ubuntu:latest # Or any other basic image + before_script: + # Install Node.js v21.7.3 manually + - apt-get update && apt-get install -y curl + - curl -fsSL https://deb.nodesource.com/setup_21.x | bash - + - apt-get install -y nodejs + - node -v # Verify the correct Node.js version + # Install Gulp globally + - npm install --global gulp-cli + - gulp --version # Verify Gulp is installed + # Set up SSH agent and add private key for pushing to protected branch + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "$SSH_PRIVATE_KEY_ENCODED" | base64 --decode > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - eval $(ssh-agent -s) + - ssh-add ~/.ssh/id_rsa + - mkdir -p ~/.ssh + - ssh-keyscan gitlab.com >> ~/.ssh/known_hosts + script: + # Check if VERSION is provided + - | + if [ -z "$VERSION" ]; then echo "Error: VERSION variable is required." && exit 1; fi + + # Run Gulp release task (includes zipping) + - gulp release + + # Create a release on GitLab + - | + export RELEASE_RESPONSE=$(curl --request POST \ + --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ + --header "Content-Type: application/json" \ + --data '{ + "name": "Release v'$VERSION'", + "tag_name": "v'$VERSION'", + "description": "Release v'$VERSION'", + "ref": "master", + "assets": { + "links": [ + { + "name": "Download kidsonbrooms.zip", + "url": "https://gitlab.com/YOUR_NAMESPACE/YOUR_PROJECT/-/jobs/$CI_JOB_ID/artifacts/download" + } + ] + } + }' "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/releases") + + # Get the release URL from the response + - export RELEASE_URL=$(echo $RELEASE_RESPONSE | jq -r '.assets.links[0].url') + + # Update the system.json file with the release URL + - | + sed -i "s|\"download\":.*|\"download\": \"$RELEASE_URL\",|" system.json + + # Commit the updated system.json and push it to master + - git config --global user.name "GitLab CI" + - git config --global user.email "ci@gitlab.com" + - git add system.json + - git commit -m "Update system.json with release URL" + - git push origin master + + # Publish the release to the Foundry API + - | + curl -X POST https://api.foundryvtt.com/_api/packages/release_version/ \ + -H "Authorization: $FOUNDRY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "id": "Your-Package-ID", + "release": { + "version": "'$VERSION'", + "manifest": "https://gitlab.com/wintermyst/kids-nbrooms/-/raw/master/system.json", + "notes": "https://gitlab.com/wintermyst/kidsonbrooms/releases/tag/v'$VERSION'", + "compatibility": { + "minimum": "12.331", + "verified": "12.331", + "maximum": "" + } + } + }' + only: + - master + when: manual + allow_failure: false + artifacts: + paths: + - kidsonbrooms.zip + expire_in: never \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..198166d --- /dev/null +++ b/.npmignore @@ -0,0 +1,10 @@ +# IDE +.idea/ +.vs/ + +# Node Modules +node_modules/ +npm-debug.log + +# Foundry +*.lock \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..a31780f --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,82 @@ +const gulp = require('gulp'); +const prefix = require('gulp-autoprefixer'); +const sourcemaps = require('gulp-sourcemaps'); +const sass = require('gulp-sass')(require('sass')); +const zip = require('gulp-zip'); + +/* ----------------------------------------- */ +/* Compile Sass +/* ----------------------------------------- */ + +// Small error handler helper function. +function handleError(err) { + console.log(err.toString()); + this.emit('end'); +} + +const SYSTEM_SCSS = ["scss/**/*.scss"]; +function compileScss() { + // Configure options for sass output. For example, 'expanded' or 'nested' + let options = { + outputStyle: 'expanded' + }; + return gulp.src(SYSTEM_SCSS) + .pipe( + sass(options) + .on('error', handleError) + ) + .pipe(prefix({ + cascade: false + })) + .pipe(gulp.dest("./css")) +} +const css = gulp.series(compileScss); + +/* ----------------------------------------- */ +/* Watch Updates +/* ----------------------------------------- */ + +function watchUpdates() { + gulp.watch(SYSTEM_SCSS, css); +} + +/* ----------------------------------------- */ +/* Export Tasks +/* ----------------------------------------- */ + +exports.default = gulp.series( + compileScss, + watchUpdates +); +exports.build = gulp.series( + compileScss +); +exports.compile = gulp.series( + compileScss +); +exports.css = css; + +/* ----------------------------------------- */ +/* Zip Release +/* ----------------------------------------- */ + +function zipRelease() { + return gulp.src([ + './**/*', + '!./node_modules/**', + '!./.git/**', + '!./.gitignore', + '!./gulpfile.js', + '!./package-lock.json', + '!./package.json', + '!./scss/**/*', + '!./.github/**/*', + ], { base: '.' }) + .pipe(zip('kidsonbrooms.zip')) + .pipe(gulp.dest('.')); +} + +exports.release = gulp.series( + compileScss, + zipRelease +); diff --git a/kids-on-brooms.zip b/kids-on-brooms.zip new file mode 100644 index 0000000..6a9fe92 Binary files /dev/null and b/kids-on-brooms.zip differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..811ae5d --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "kids-on-brooms", + "version": "2.0.0", + "description": "CSS compiler for the Kids On Brooms system", + "scripts": { + "build": "gulp build", + "compile": "gulp css", + "watch": "gulp", + "gulp": "gulp" + }, + "browserslist": [ + "last 5 versions" + ], + "author": "Joscha Maier", + "license": "MIT", + "private": true, + "dependencies": { + "gulp": "^5", + "gulp-autoprefixer": "^8", + "gulp-sass": "^5", + "gulp-sourcemaps": "^2.6.5", + "gulp-zip": "^5.0.1", + "kids-on-brooms": "file:" + }, + "devDependencies": { + "sass": "^1.79.1" + } +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e0141b6 --- /dev/null +++ b/readme.md @@ -0,0 +1,3 @@ +The Kids On Brooms System Implemented in FoundryVTT, reupload from https://github.com/Singularity-Lathe-VTT/kids-on-brooms + +To get support create a issue on this Repository \ No newline at end of file diff --git a/system.json b/system.json new file mode 100644 index 0000000..ead9dcd --- /dev/null +++ b/system.json @@ -0,0 +1,24 @@ +{ + "id": "kidsonbrooms", + "title": "Kids on Brooms System", + "description": "The Kids on Brooms system for FoundryVTT! - Deprecated", + "version": "0.0.1", + "compatibility": { + "minimum": 12, + "verified": 12 + }, + "authors": [{ + "name": "Josiah Bradbury, Joscha Maier" + }], + "esmodules": ["module/kidsonbrooms.mjs"], + "styles": ["css/kidsonbrooms.css"], + "socket": true, + "grid": { + "distance": 5, + "units": "ft" + }, + "primaryTokenAttribute": "system.adversityTokens", + "url": "https://gitlab.com/wintermyst/kidsonbrooms", + "manifest": "https://github.com/josmaier/KidsOnBroomsFoundryVTT/blob/1c09eda6c50756a87ffcbdf27c31b732c3420d7c/system.json", + "download": "https://github.com/josmaier/KidsOnBroomsFoundryVTT/releases/download/0.0.1/kids-on-brooms.zip" +}