CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.
:sparkles: Introducing new features.Incorporating automatic publishin… (#1107)
zhanghengxinc67ee1731c79
diff --git a/.github/workflows/publish_npm.yaml b/.github/workflows/publish_npm.yamlnew file mode 100644index 0000000..de4c139--- /dev/null+++ b/.github/workflows/publish_npm.yaml@@ -0,0 +1,38 @@+name: publish npm++on:+ push:+ tags:+ - v*.*.*+ workflow_dispatch:++permissions:+ contents: write++jobs:+ publish-npm:+ runs-on: ubuntu-22.04+ steps:+ - uses: actions/checkout@v3+ - uses: actions/setup-node@v3+ with:+ node-version: 16+ registry-url: https://registry.npmjs.org/+ - name: Get version+ id: get_version+ run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}+ - name: Set version+ run: |+ sudo apt-get install jq+ jq '.version="${{ steps.get_version.outputs.VERSION }}"' package.json > package.json.new+ mv package.json.new package.json+ - name: Generate SDK+ run: |+ npm cache clean --force+ npm install @openapitools/openapi-generator-cli -g+ make build+ - run: npm i+ - run: npm run start+ - run: npm publish -W+ env:+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}diff --git a/package.json b/package.jsonnew file mode 100644index 0000000..b0ba851--- /dev/null+++ b/package.json@@ -0,0 +1,38 @@+{+ "name": "@icewhale/casaos-openapi",+ "version": "0.0.1",+ "scripts": {+ "clean": "rm -rf generate",+ "build": "rm -rf dist && tsc && yarn clean",+ "generate:local": "openapi-generator-cli generate -g typescript-axios -i ./api/casaos/openapi.yaml -o ./generate",+ "generate:npx": "npx @openapitools/openapi-generator-cli generate -g typescript-axios -i ./api/casaos/openapi.yaml -o ./generate",+ "generate:ts": "npx openapi-typescript-codegen --input ./api/casaos/openapi.yaml --output ./generate",+ "start": "yarn generate:local && yarn build"+ },+ "homepage": "https://github.com/IceWhaleTech/CasaOS#readme",+ "description": "Casaos Typescript+Axios SDK",+ "keywords": [+ "CasaOS",+ "SDK",+ "CasaOS Axios"+ ],+ "main": "dist/index.js",+ "files": [+ "LICENSE",+ "README.md",+ "dist",+ "generate"+ ],+ "dependencies": {+ "axios": "^1.1.0"+ },+ "devDependencies": {+ "all-contributors-cli": "^6.24.0",+ "@openapitools/openapi-generator-cli": "2.5.2",+ "@types/node": "^18.8.3",+ "openapi-typescript-codegen": "^0.23.0",+ "typescript": "^4.9.5"+ },+ "author": "casaos",+ "license": "Apache-2.0"+}\ No newline at end of filediff --git a/tsconfig.json b/tsconfig.jsonnew file mode 100644index 0000000..89d3573--- /dev/null+++ b/tsconfig.json@@ -0,0 +1,25 @@+{+ "compilerOptions": {+ "declaration": true,+ "lib": [+ "es2017",+ "DOM"+ ],+ "module": "commonjs",+ "target": "es6",+ "skipLibCheck": true,+ "sourceMap": false,+ "strict": true,+ "useUnknownInCatchVariables": false,+ "resolveJsonModule": true,+ "esModuleInterop": true,+ "outDir": "dist",+ "types": [+ "node"+ ],+ },+ "exclude": [+ "node_modules"+ ],+ "main": "generate/index"+}\ No newline at end of file