adding pack tools.
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
name: Release Creation
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# get part of the tag after the `v`
|
||||||
|
- name: Extract tag version number
|
||||||
|
id: get_version
|
||||||
|
uses: battila7/get-version-action@v2
|
||||||
|
|
||||||
|
# Substitute the Manifest and Download URLs in the module.json
|
||||||
|
- name: Substitute Manifest and Download Links For Versioned Ones
|
||||||
|
id: sub_manifest_link_version
|
||||||
|
uses: microsoft/variable-substitution@v1
|
||||||
|
with:
|
||||||
|
files: "system.json"
|
||||||
|
env:
|
||||||
|
version: ${{steps.get_version.outputs.version-without-v}}
|
||||||
|
url: https://github.com/${{github.repository}}
|
||||||
|
manifest: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/system.json
|
||||||
|
download: https://github.com/${{github.repository}}/releases/download/${{github.event.release.tag_name}}/system.zip
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
# Pull YAML to LDB packs
|
||||||
|
- name: Build Packs
|
||||||
|
run: npm run pullYAMLtoLDB
|
||||||
|
|
||||||
|
# Create a zip file with all files required by the module to add to the release
|
||||||
|
- run: zip -r ./system.zip system.json template.json asset/ css/ lang/ module/ templates/ packs/
|
||||||
|
|
||||||
|
# Create a release for this specific version
|
||||||
|
- name: Update Release with Files
|
||||||
|
id: create_version_release
|
||||||
|
uses: ncipollo/release-action@v1
|
||||||
|
with:
|
||||||
|
allowUpdates: true # Set this to false if you want to prevent updating existing releases
|
||||||
|
name: ${{ github.event.release.name }}
|
||||||
|
draft: ${{ github.event.release.unpublished }}
|
||||||
|
prerelease: ${{ github.event.release.prerelease }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
artifacts: "./system.json, ./system.zip"
|
||||||
|
tag: ${{ github.event.release.tag_name }}
|
||||||
|
body: ${{ github.event.release.body }}
|
||||||
|
|
||||||
+3
-3
@@ -1,13 +1,13 @@
|
|||||||
# IDE
|
# IDE
|
||||||
.idea/
|
.idea/
|
||||||
.vs/
|
.vsode
|
||||||
|
|
||||||
# Node Modules
|
# Node Modules
|
||||||
node_modules/
|
node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
||||||
# les bdd de packs
|
# les bdd de packs
|
||||||
packs/
|
packs
|
||||||
|
|
||||||
# Foundry
|
# Foundry
|
||||||
*.lock
|
*.lock
|
||||||
|
|||||||
+5
-3
@@ -5,14 +5,16 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"launch window Foundry11": "cd C:/Program Files/Foundry Virtual Tabletop_V11/resources/app && node main.js",
|
|
||||||
"launch Foundry12": "cd C:/Program Files/Foundry Virtual Tabletop_V12/resources/app && node main.js",
|
"launch Foundry12": "cd C:/Program Files/Foundry Virtual Tabletop_V12/resources/app && node main.js",
|
||||||
"watch": "gulp watch",
|
"watch": "gulp watch",
|
||||||
"buildStyle": "gulp buildStyles"
|
"buildStyle": "gulp buildStyles",
|
||||||
|
"pushLDBtoYAML": "node ./tools/pushLDBtoYAML.mjs",
|
||||||
|
"pullYAMLtoLDB": "node ./tools/pullYAMLtoLDB.mjs"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "Rwan",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typhonjs-fvtt/eslint-config-foundry.js": "^0.8.0",
|
"@typhonjs-fvtt/eslint-config-foundry.js": "^0.8.0",
|
||||||
|
"@foundryvtt/foundryvtt-cli": "^1.0.2",
|
||||||
"browser-sync": "^2.27.11",
|
"browser-sync": "^2.27.11",
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
"gulp-sass": "^5.1.0",
|
"gulp-sass": "^5.1.0",
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { compilePack } from '@foundryvtt/foundryvtt-cli';
|
||||||
|
import { promises as fs } from 'fs';
|
||||||
|
|
||||||
|
const MODULE_ID = process.cwd();
|
||||||
|
const yaml = true;
|
||||||
|
|
||||||
|
const packs = await fs.readdir('./src/packs');
|
||||||
|
for (const pack of packs) {
|
||||||
|
if (pack === '.gitattributes') continue;
|
||||||
|
console.log('Packing ' + pack);
|
||||||
|
await compilePack(
|
||||||
|
`${MODULE_ID}/src/packs/${pack}`,
|
||||||
|
`${MODULE_ID}/packs/${pack}`,
|
||||||
|
{ yaml }
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { extractPack } from "@foundryvtt/foundryvtt-cli";
|
||||||
|
import { promises as fs } from "fs";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
const MODULE_ID = process.cwd();
|
||||||
|
const yaml = true;
|
||||||
|
const log = true;
|
||||||
|
|
||||||
|
const packs = await fs.readdir("./packs");
|
||||||
|
for (const pack of packs) {
|
||||||
|
if (pack === ".gitattributes") continue;
|
||||||
|
|
||||||
|
const packPath = path.join("./packs", pack);
|
||||||
|
const stats = await fs.lstat(packPath); // Utilisation de lstat pour vérifier si c'est un fichier ou un répertoire
|
||||||
|
|
||||||
|
if (!stats.isDirectory()) {
|
||||||
|
console.log(`${pack} est un fichier, il est ignoré.`);
|
||||||
|
continue; // Si ce n'est pas un répertoire, passer à l'élément suivant
|
||||||
|
}
|
||||||
|
console.log("Unpacking " + pack);
|
||||||
|
const directory = `./src/packs/${pack}`;
|
||||||
|
try {
|
||||||
|
console.log(directory);
|
||||||
|
for (const file of await fs.readdir(directory)) {
|
||||||
|
await fs.unlink(path.join(directory, file));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code === "ENOENT") console.log("No files inside of " + pack);
|
||||||
|
else console.log(error);
|
||||||
|
}
|
||||||
|
await extractPack(
|
||||||
|
`${MODULE_ID}/packs/${pack}`,
|
||||||
|
`${MODULE_ID}/src/packs/${pack}`,
|
||||||
|
{
|
||||||
|
yaml,
|
||||||
|
transformName,
|
||||||
|
log
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Prefaces the document with its type
|
||||||
|
* @param {object} doc - The document data
|
||||||
|
*/
|
||||||
|
function transformName(doc) {
|
||||||
|
const safeFileName = doc.name.replace(/[^a-zA-Z0-9А-я]/g, "_");
|
||||||
|
const type = doc._key.split("!")[1];
|
||||||
|
const prefix = ["actors", "items"].includes(type) ? doc.type : type;
|
||||||
|
|
||||||
|
return `${doc.name ? `${prefix}_${safeFileName}_${doc._id}` : doc._id}.${yaml ? "yml" : "json"
|
||||||
|
}`;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user