跳到主要内容

Plugin Packaging

The Atomgit Actions plugin requires executing build commands to generate executable js files, which can be directly referenced and executed in the pipeline. The build process is orchestrated through configuration in package.json.

Build Configuration Example (TS Project)

{
"name": "gitcode-actions-plugin-demo",
"version": "1.0.11",
"description": "demo plugin",
"main": "main.js",
"scripts": {
"build": "tsc",
"package-main": "ncc build lib/main.js",
"package-stop": "ncc build lib/stop.js -o dist/stop && move dist\\stop\\main.js dist\\stop.js && rmdir /S /Q dist\\stop",
"test": "jest",
"all": "npm run build && npm run package-main && npm run package-stop",
"dev": "npm run build && npm run package"
},
"devDependencies": {
"@actions/core": "^1.11.1",
"@types/node": "^22.7.6"
},
"dependencies": {
"axios": "^1.7.7"
}
}

Build Steps

  1. Compile: npm run build — Execute TypeScript compilation
  2. Package: npm run package-main and npm run package-stop — Package into a single file using ncc
  3. One-click Build: npm run all — Compile + Package