add a publish workflow,

Squashed commit of the following:

commit 7a7699d193
And fixed formatting of package-lock.json
Author: unknown <348063288@qq.com>
Date:   Sat Sep 9 18:08:53 2023 +0800

    add a publish workflow
pull/378/head^2
僵尸浩 2023-10-07 12:20:13 +03:00 committed by Abdullah Alfaraj
parent d748a899f6
commit ad4fcfa7df
9 changed files with 1225 additions and 104 deletions

54
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: publish ccx and make tag
on:
workflow_dispatch:
inputs:
tag_name:
description: 'tag name'
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create Release Asset
shell: bash
run: |
cd $GITHUB_WORKSPACE
npm i
npm run publish
node build-script/pack-ccx.mjs --version ${{ github.event.inputs.tag_name }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.tag_name }}
release_name: v${{ github.event.inputs.tag_name }}
draft: true
prerelease: false
- name: Upload ZIP
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Auto.Photoshop.SD.plugin_v${{ github.event.inputs.tag_name }}.zip
asset_name: Auto.Photoshop.SD.plugin_v${{ github.event.inputs.tag_name }}.zip
asset_content_type: application/zip
- name: Upload CCX
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Auto.Photoshop.SD.plugin_v${{ github.event.inputs.tag_name }}.ccx
asset_name: Auto.Photoshop.SD.plugin_v${{ github.event.inputs.tag_name }}.ccx
asset_content_type: application/zip

1
.gitignore vendored
View File

@ -17,6 +17,7 @@ experimental/
start_server.sh
start_server.bat
*.ccx
*.zip
expanded_mask.png
original_mask.png
/config

69
build-script/pack-ccx.mjs Normal file
View File

@ -0,0 +1,69 @@
import chalk from 'chalk';
import { program } from 'commander';
import { createWriteStream, readFileSync, statSync, writeFileSync } from 'fs';
import { globSync } from 'glob';
import { dirname, join, relative } from 'path';
import { fileURLToPath } from 'url';
import yazl from 'yazl'
const __dirname = dirname(fileURLToPath(import.meta.url))
const basePath = join(__dirname, '..')
program
.requiredOption("--version <platform>", "the target platform")
.parse();
const version = program.opts().version;
if (!version.match(/\d+\.\d+\.\d+/)) throw new Error(`invalid version format: ${version}`);
console.log(chalk.cyan("rewriting manifest.json's version field to " + version));
const manifest = JSON.parse(readFileSync(`${basePath}/manifest.json`, 'utf-8'));
manifest.version = version;
writeFileSync(`${basePath}/manifest.json`, JSON.stringify(manifest));
console.log(chalk.cyan("rewriting package.json's version field to " + version));
const packageJSON = JSON.parse(readFileSync(`${basePath}/package.json`, 'utf-8'));
packageJSON.version = version;
writeFileSync(`${basePath}/package.json`, JSON.stringify(packageJSON));
console.log(chalk.cyan("packaging .ccx"));
const zipList = [
'./manifest.json',
'./i18n/**/*',
'./icon/**/*',
'./jimp/**/*',
'./scripts/**/*',
'./typescripts/dist/**/*',
'./utility/**/*',
'./server/**/*',
'./*.js',
'./package.json',
'./tsconfig.json',
'./*.html',
'./*.py',
'./*.txt',
'./*.md',
'./*.png',
]
const zipfile = new yazl.ZipFile();
zipList.forEach(globber => {
globSync(
join(basePath, globber).replace(/\\/g, '/')
).forEach(filepath => {
if (statSync(filepath).isDirectory()) return;
const rpath = relative(basePath, filepath);
zipfile.addFile(filepath, rpath)
})
})
zipfile.outputStream.pipe(
createWriteStream(join(basePath, `Auto.Photoshop.SD.plugin_v${version}.ccx`))
);
zipfile.outputStream.pipe(
createWriteStream(join(basePath, `Auto.Photoshop.SD.plugin_v${version}.zip`))
);
zipfile.end()

View File

@ -4,10 +4,10 @@ const CopyPlugin = require('copy-webpack-plugin')
module.exports = {
entry: {
bundle: './typescripts/entry.ts',
bundle: path.resolve(__dirname, '../typescripts/entry.ts'),
},
output: {
path: path.resolve(__dirname, './typescripts/dist'),
path: path.resolve(__dirname, '../typescripts/dist'),
filename: '[name].js',
libraryTarget: 'commonjs2',
},
@ -35,7 +35,7 @@ module.exports = {
loader: 'ts-loader',
exclude: /node_modules/,
options: {
configFile: 'tsconfig.json',
configFile: path.resolve(__dirname, '../typescripts/tsconfig.json'),
},
},
{

View File

@ -8,9 +8,7 @@ const _log = console.log
const _warn = console.warn
const _error = console.error
let g_timer_value = 300 // temporary global variable for testing the timer pause function
let g_version = 'v1.3.2'
let g_version = 'v' + JSON.parse(require('fs').readFileSync("plugin:manifest.json", 'utf-8')).version
let g_sd_url = 'http://127.0.0.1:7860'
let g_online_data_url =
'https://raw.githubusercontent.com/AbdullahAlfaraj/Auto-Photoshop-StableDiffusion-Plugin/master/utility/online_data.json'

View File

@ -1,13 +1,11 @@
{
"id": "auto.photoshop.stable.diffusion.plugin",
"name": "Auto Photoshop Stable Diffusion Plugin",
"version": "1.1.0",
"host": [
{
"app": "PS",
"minVersion": "24.0.0"
}
],
"version": "1.3.1",
"host": {
"app": "PS",
"minVersion": "24.0.0"
},
"main": "index.html",
"manifestVersion": 5,
"requiredPermissions": {

1158
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "uxp-template-default-starter",
"version": "1.0.0",
"name": "auto-photoshop-stable-diffusion-plugin",
"version": "1.3.1",
"description": "Default template for creating Adobe UXP based photoshop plugin.",
"author": "Adobe Inc",
"license": "Apache-2.0",
@ -31,9 +31,11 @@
"@svgr/webpack": "^8.0.1",
"babel-loader": "^9.1.2",
"clean-webpack-plugin": "^4.0.0",
"commander": "^11.0.0",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"file-loader": "^6.2.0",
"glob": "^10.3.4",
"nodemon": "^2.0.22",
"prettier": "2.8.3",
"style-loader": "^3.3.2",
@ -42,12 +44,15 @@
"typescript": "^5.0.4",
"url-loader": "^4.1.1",
"webpack": "^5.82.1",
"webpack-cli": "^5.1.1"
"webpack-cli": "^5.1.1",
"chalk": "^5.3.0",
"yazl": "^2.5.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "npx webpack --config webpack.config.js --watch",
"build": "npx webpack --config webpack.config.js",
"watch": "npx webpack --config ./build-script/webpack.config.js --watch",
"build": "npx webpack --config ./build-script/webpack.config.js",
"publish": "npx webpack --config ./build-script/webpack.config.js --mode production",
"format": "npx prettier -w typescripts"
},
"repository": {

View File

@ -31,7 +31,7 @@
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
"typeRoots": ["./*/@types","./*/types","./types", "./node_modules/@types"], /* Specify multiple folders that act like './node_modules/@types'. */
"typeRoots": ["./@types","./types", "../node_modules/@types"], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
@ -56,7 +56,7 @@
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./typescripts/dist", /* Specify an output folder for all emitted files. */
"outDir": "../typescripts/dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
@ -107,6 +107,6 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": ["./jimp"],
"exclude": ["../jimp"],
// "include": ["./typescripts/@types/custom.d.ts"]
}