diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 20f5dc9..940bd64 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -1,8 +1,6 @@ name: Node.js CI on: - push: - branches: [master] pull_request: branches: [master] @@ -35,15 +33,3 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: npm run build - - name: Compare Versions - run: | - TAG_VERSION=$(echo ${{env.TAG}} | tr -dc '0-9') - PACKAGE_VERSION=$(echo ${{env.PACKAGE}} | tr -dc '0-9') - - if (( $((10#$PACKAGE_VERSION + 1)) > $((10#$TAG_VERSION + 1)) )); then - echo "new version start release" - echo "RELEASE=true" >> "$GITHUB_ENV" - else - echo "no new version to release" - echo "RELEASE=false" >> "$GITHUB_ENV" - fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..763beb6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: release + +on: + push: + branches: [master] + +jobs: + release: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + node-version: [20.x] + + runs-on: ${{ matrix.os }} + timeout-minutes: 20 + + steps: + - name: Github checkout + uses: actions/checkout@v4 + if: matrix.os == 'ubuntu-latest' + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Install dependencies + run: npm ci + - run: npm run lint:check + - run: npm audit --audit-level=critical + - run: npm run test:ci + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: build 🔧 + run: npm run build + - name: Generate changelog + uses: jaywcjlove/changelog-generator@main + id: changelog + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Build Release + uses: jaywcjlove/create-tag-action@main + id: tag_release + with: + release: true + token: ${{ secrets.GITHUB_TOKEN }} + body: | + ${{ steps.changelog.outputs.compareurl }} + + ${{ steps.changelog.outputs.changelog }} + - name: Publish package on NPM 📦 + if: steps.tag_release.outputs.successful + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + diff --git a/package-lock.json b/package-lock.json index 2abc055..d1aa357 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "hostsless", + "name": "@geek-fun/hostsless", "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "hostsless", + "name": "@geek-fun/hostsless", "version": "0.0.0", "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 8c977e8..6736f82 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,10 @@ { - "name": "hostsless", + "name": "@geek-fun/hostsless", "version": "0.0.0", "description": "Full life cycle cross providers serverless application management for your fast-growing business.", - "main": "index.js", + "homepage": "https://hostsless.geekfun.club", + "main": "dist/src/index.js", + "types": "dist/src/index.d.ts", "bin": { "hls": "dist/src/commands/index.js" }, @@ -15,7 +17,7 @@ }, "repository": { "type": "git", - "url": "git@github.com:geek-fun/hostsless.git" + "url": "git+https://github.com/geek-fun/hostsless.git" }, "author": "geekfun ", "license": "Apache-2.0", @@ -27,7 +29,6 @@ "i18n": "^0.15.1", "pino": "^8.17.2" }, - "homepage": "https://hostsless.geekfun.club", "devDependencies": { "@types/i18n": "^0.13.10", "@types/jest": "^29.5.11", diff --git a/tsconfig.json b/tsconfig.json index 03f77f8..361d781 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "target": "ES2020", "module": "commonjs", + "declaration": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, @@ -12,3 +13,4 @@ }, "include": ["src/**/*"] } +