diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71d3f42..7a504e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,8 @@ name: CI on: - pull_request: + workflow_dispatch: + # pull_request: temporary exclude jobs: commit-lint: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 672a4d0..4364410 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,45 +1,125 @@ name: release on: - push: - branches: - - main + pull_request: # remove me when ready workflow_dispatch: permissions: contents: read jobs: - release-please: + check: + name: Check version runs-on: ubuntu-latest outputs: - release_created: ${{ steps.release.outputs.release_created }} - permissions: - contents: write - pull-requests: write + version: ${{ steps.version.outputs.version }} steps: - - uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0 - id: release + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + - name: Check version changes + uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 + id: version with: - token: ${{ secrets.RELEASE_PLEASE_GITHUB_TOKEN }} - config-file: release-please-config.json - manifest-file: .release-please-manifest.json + diff-search: true + file-name: package.json - release: - needs: release-please - if: ${{ needs.release-please.outputs.release_created }} + build: + strategy: + matrix: + include: + - os: windows-2022 + target: x86_64-pc-windows-msvc + code-target: win32-x64 + - os: ubuntu-20.04 + target: x86_64-unknown-linux-gnu + code-target: linux-x64 + - os: macos-14 + target: aarch64-apple-darwin + code-target: darwin-arm64 + name: Package ${{ matrix.code-target }} + runs-on: ${{ matrix.os }} + needs: check + env: + version: ${{ needs.check.outputs.version }} + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install Node.js + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 + with: + node-version-file: '.nvmrc' + - name: Install linux toolchain + if: matrix.code-target == 'linux-x64' + run: | + sudo apt install nsis p7zip-full p7zip-rar -y + - name: Install win32 toolchain + if: matrix.code-target == 'win32-x64' + run: | + choco install 7zip nsis grep -y + echo "C:\Program Files (x86)\GnuWin32\bin" >> $GITHUB_PATH + - name: Install npm dependencies + run: npm ci + - name: Build javascript + run: npm run build + - name: Build binaries + shell: bash + run: | + cd packages/cli-${{ matrix.code-target }} + npm ci + npm run pack + - name: Debug Oclif output + shell: bash + run: | + ls -lah packages/cli-${{ matrix.code-target }}/dist + - name: Upload CLI artifact + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1 + with: + name: cli-${{ matrix.code-target }} + path: ./packages/cli-${{ matrix.code-target }}/dist/hd-* + if-no-files-found: error + publish-cli: + name: Publish runs-on: ubuntu-latest + needs: + - build permissions: contents: write id-token: write steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 + - name: Install Node.js + uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 with: node-version-file: '.nvmrc' registry-url: 'https://registry.npmjs.org' - - run: npm install - - run: npm run build - - name: Create NPM release - run: npm publish --provenance --access public + - name: Create artifacts folder if it doesn't exist + run: mkdir -p artifacts + - name: Download CLI artifacts + uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9 + with: + pattern: cli-* + merge-multiple: true + path: artifacts + - name: Debug artifact paths + run: ls -lah artifacts/ + - name: Publish npm packages as latest # remove dry-run when ready + run: | + ls -lah artifacts/ # Debug output + for artifact in artifacts/*; do + echo "$artifact" + npm publish "./$artifact" --tag latest --access public --provenance --dry-run + done env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Debug artifacts before release + run: ls -lah artifacts/ + - name: Create GitHub release and tag + uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: CLI v${{ needs.check.outputs.version }} + tag_name: cli/v${{ needs.check.outputs.version }} + draft: true # Keep as a draft during dry run + files: | + artifacts/*.tar.gz + fail_on_unmatched_files: true + generate_release_notes: true diff --git a/.gitignore b/.gitignore index 8173f03..822477c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,15 +2,12 @@ *-error.log **/.DS_Store /.idea -/dist -/tmp +dist +tmp node_modules oclif.manifest.json - yarn.lock pnpm-lock.yaml - +**/packages/cli-*/bin/ **/tsconfig.tsbuildinfo - -# cli-generated files nes.**.** diff --git a/.release-please-manifest.json b/.release-please-manifest.json deleted file mode 100644 index 895bf0e..0000000 --- a/.release-please-manifest.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - ".": "2.0.0" -} diff --git a/README.md b/README.md index a6c1f47..b28ccd4 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,7 @@ The HeroDevs CLI [![Downloads/week](https://img.shields.io/npm/dw/@herodevs/cli.svg)](https://npmjs.org/package/@herodevs/cli) -* [Usage](#usage) -* [Commands](#commands) +* [@herodevs/cli](#herodevscli) ## Usage @@ -17,7 +16,7 @@ $ npm install -g @herodevs/cli $ hd COMMAND running command... $ hd (--version) -@herodevs/cli/2.0.0 darwin-arm64 node-v22.14.0 +@herodevs/cli/2.0.0 darwin-arm64 node-v22.13.0 $ hd --help [COMMAND] USAGE $ hd COMMAND @@ -37,44 +36,14 @@ USAGE * [`hd plugins uninstall [PLUGIN]`](#hd-plugins-uninstall-plugin) * [`hd plugins unlink [PLUGIN]`](#hd-plugins-unlink-plugin) * [`hd plugins update`](#hd-plugins-update) -* [`hd report committers [FILE]`](#hd-report-committers-file) -* [`hd report purls`](#hd-report-purls) -* [`hd scan eol`](#hd-scan-eol) -* [`hd scan sbom`](#hd-scan-sbom) -### `hd help [COMMAND]` +## `hd help [COMMAND]` Display help for hd. ``` - -_See code: [src/commands/hello/index.ts](https://github.com/mdonnalley/mycli123/blob/v0.0.0/src/commands/hello/index.ts)_ - -### `mycli123 hello world` - -Say hello world - -```text -USAGE - $ mycli123 hello world - -DESCRIPTION - Say hello world - -EXAMPLES - $ mycli123 hello world - hello world! (./src/commands/hello/world.ts) -``` - -_See code: [src/commands/hello/world.ts](https://github.com/mdonnalley/mycli123/blob/v0.0.0/src/commands/hello/world.ts)_ - -### `mycli123 help [COMMAND]` - -Display help for mycli123. - -```text USAGE - $ mycli123 help [COMMAND...] [-n] + $ hd help [COMMAND...] [-n] ARGUMENTS COMMAND... Command to show help for. @@ -88,7 +57,7 @@ DESCRIPTION _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.26/src/commands/help.ts)_ -### `hd plugins` +## `hd plugins` List installed plugins. @@ -111,7 +80,7 @@ EXAMPLES _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/index.ts)_ -### `hd plugins add PLUGIN` +## `hd plugins add PLUGIN` Installs a plugin into hd. @@ -158,7 +127,7 @@ EXAMPLES $ hd plugins add someuser/someplugin ``` -### `hd plugins:inspect PLUGIN...` +## `hd plugins:inspect PLUGIN...` Displays installation properties of a plugin. @@ -185,7 +154,7 @@ EXAMPLES _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/inspect.ts)_ -### `hd plugins install PLUGIN` +## `hd plugins install PLUGIN` Installs a plugin into hd. @@ -234,11 +203,11 @@ EXAMPLES _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/install.ts)_ -### `hd plugins link PATH` +## `hd plugins link PATH` Links a plugin into the CLI for development. -```text +``` USAGE $ hd plugins link PATH [-h] [--install] [-v] @@ -265,7 +234,7 @@ EXAMPLES _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/link.ts)_ -### `hd plugins remove [PLUGIN]` +## `hd plugins remove [PLUGIN]` Removes a plugin from the CLI. @@ -291,7 +260,7 @@ EXAMPLES $ hd plugins remove myplugin ``` -### `hd plugins reset` +## `hd plugins reset` Remove all user-installed and linked plugins. @@ -306,7 +275,7 @@ FLAGS _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/reset.ts)_ -### `hd plugins uninstall [PLUGIN]` +## `hd plugins uninstall [PLUGIN]` Removes a plugin from the CLI. @@ -334,7 +303,7 @@ EXAMPLES _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/uninstall.ts)_ -### `hd plugins unlink [PLUGIN]` +## `hd plugins unlink [PLUGIN]` Removes a plugin from the CLI. @@ -360,7 +329,7 @@ EXAMPLES $ hd plugins unlink myplugin ``` -### `hd plugins update` +## `hd plugins update` Update installed plugins. @@ -377,112 +346,4 @@ DESCRIPTION ``` _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/update.ts)_ - -### `hd report committers [FILE]` - -Generate report of committers to a git repository - -```text -USAGE - $ hd report committers [FILE] [-f] [-n ] - -ARGUMENTS - FILE file to read - -FLAGS - -f, --force - -n, --name= name to print - -DESCRIPTION - Generate report of committers to a git repository - -EXAMPLES - $ hd report committers -``` - -_See code: [src/commands/report/committers.ts](https://github.com/herodevs/cli/blob/v2.0.0/src/commands/report/committers.ts)_ - -### `hd scan eol [DIR]` - -Generate a list of purls from a sbom - -```text -USAGE - $ hd report purls [-f ] [-d ] [-s] [-o json|csv] - -FLAGS - -d, --dir= The directory to scan in order to create a cyclonedx sbom - -f, --file= The file path of an existing cyclonedx sbom to scan for EOL - -o, --output=