From b8badbd0274fb530ff3db7dfb0c80accecfc6665 Mon Sep 17 00:00:00 2001 From: fewensa Date: Wed, 17 Jul 2024 06:44:32 +0000 Subject: [PATCH] Publish --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ package.json | 2 +- template/ts/files/package.json | 9 +++++++-- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0f49140 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: 'Publish' + +on: + push: + tags: + - "v*" + workflow_dispatch: + + +jobs: + + publish-npm: + name: Publish NPM + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install Deps + run: npm i + + - name: Build template + run: npm run build:ts + + - name: Publish ts + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + run: | + cd generated/typescript + npm run release + diff --git a/package.json b/package.json index d15faef..df6d952 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Generate Helix conf", "scripts": { "codegen": "zx scripts/generate/index.mjs", - "build:ts": "npm run generate -- --language=ts && cd generated/typescript && npm i && npm run build", + "build:ts": "npm run codegen -- --language=ts && cd generated/typescript && npm i && npm run build", "test:ts": "npm run build:ts && cd generated/typescript && npm run test" }, "author": "", diff --git a/template/ts/files/package.json b/template/ts/files/package.json index 682ef43..b3a6a12 100644 --- a/template/ts/files/package.json +++ b/template/ts/files/package.json @@ -3,9 +3,13 @@ "version": "0.0.1", "description": "Helix conf", "main": "dist/src/index.js", + "publishConfig": { + "access": "public" + }, "scripts": { "build": "rm -rf dist && tsc", - "test": "jest" + "test": "jest", + "release": "lerna publish --yes --no-verify-access" }, "author": "HelixBridge", "license": "MIT", @@ -14,6 +18,7 @@ "jest": "^29.7.0", "ts-jest": "^29.1.5", "ts-node": "^10.9.2", - "typescript": "^5.5.3" + "typescript": "^5.5.3", + "lerna": "^8.1.6" } }