From 125d4e32ceb442004aecbd6e7d9c102687fcc2d2 Mon Sep 17 00:00:00 2001 From: Masaharu Tashiro Date: Fri, 18 Oct 2024 14:53:09 +0900 Subject: [PATCH] feat: init repository --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ .gitignore | 4 ++++ .release-please-manifest.json | 3 +++ cli.js | 2 ++ package.json | 33 ++++++++++++++++++++++++++++ release-please-config.json | 16 ++++++++++++++ 6 files changed, 99 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100644 .release-please-manifest.json create mode 100644 cli.js create mode 100644 package.json create mode 100644 release-please-config.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ae93d4d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: release +on: + push: + branches: + - main + +jobs: + release: + name: Create draft release + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4 + id: release + + publish-npm: + name: Publish to npm + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + needs: [release] + if: ${{ needs.release.outputs.release_created }} + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + - uses: actions/setup-node@v4 + with: + node-version: "18" + cache: "pnpm" + - run: pnpm install --frozen-lockfile + - name: Configure npm user + run: npm config set "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: pnpm publish --access public + env: + # https://docs.npmjs.com/generating-provenance-statements#using-third-party-package-publishing-tools + NPM_CONFIG_PROVENANCE: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fb67e2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules + +.idea +.vscode diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..b985ff6 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} diff --git a/cli.js b/cli.js new file mode 100644 index 0000000..65c663d --- /dev/null +++ b/cli.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +console.log("This is the test CLI!") diff --git a/package.json b/package.json new file mode 100644 index 0000000..c227309 --- /dev/null +++ b/package.json @@ -0,0 +1,33 @@ +{ + "name": "@tasshi/demo-publish-node-cli-tool", + "version": "1.0.0", + "description": "Demo repository publishing Node.js based CLI to npm registry using pnpm", + "publishConfig": { + "access": "public" + }, + "author": "Masaharu TASHIRO ", + "bin": { + "demo-cli": "cli.js" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/tasshi-playground/demo-publish-node-cli-tool.git" + }, + "files": [ + "CHANGELOG.md", + "cli.js" + ], + "bugs": { + "url": "https://github.com/tasshi-playground/demo-publish-node-cli-tool/issues" + }, + "homepage": "https://github.com/tasshi-playground/demo-publish-node-cli-tool/#readme", + "engines": { + "node": ">=18" + }, + "packageManager": "pnpm@8.15.9", + "keywords": [], + "license": "MIT" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..d750bb0 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,16 @@ +{ + "packages": { + ".": { + "release-type": "node", + "prerelease": false, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "changelog-path": "CHANGELOG.md", + "versioning": "default", + "include-component-in-tag": false, + "include-v-in-tag": true, + "pull-request-title-pattern": "chore: release ${version} from ${branch}", + "component-no-space": true + } + } +}