Skip to content

Commit

Permalink
feat: add release steps and instructions to use CLI on MacOS (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Jun 29, 2022
1 parent 6c2f293 commit 706c875
Show file tree
Hide file tree
Showing 6 changed files with 2,900 additions and 5,889 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/bump-homebrew-formula.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Bump Homebrew formula for CLI

on:
# It cannot run on release event as when release is created then version is not yet bumped in package.json
# This means we cannot extract easily latest version and have a risk that package is not yet on npm
push:
branches:
- master

jobs:
bump-formula-in-homebrew:
name: Bump the formula in homebrew-core repo
if: startsWith(github.event.commits[0].message, 'chore(release):')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Get version from package.json
id: extractver
run: echo "::set-output name=version::$(npm run get-version --silent)"
- uses: mislav/bump-homebrew-formula-action@v2
with:
# A PR will be sent to github.com/Homebrew/homebrew-core to update this formula:
formula-name: asyncapi
tag-name: ${{ steps.extractver.outputs.version }}
download-url: https://registry.npmjs.org/@asyncapi/cli/-/cli-${{ steps.extractver.outputs.version }}.tgz #we need to point to npm not github as there is a dist that is not on github
env:
COMMITTER_TOKEN: ${{ secrets.GH_TOKEN_BOT_EVE }}
52 changes: 52 additions & 0 deletions .github/workflows/upload-release-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Upload custom assets to GitHub release

on:
release:
types:
- published

jobs:
upload-assets:
name: Generate and upload assets
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# - os: ubuntu-latest
# npm_script: pack:linux
# dist_folder: deb
# extension: tar.gz #or deb, we do not know yet
# - os: windows-latest
# npm_script: pack:windows
# dist_folder: win
# extension: exe
- os: macos-latest
npm_script: pack:macos
dist_folder: macos
extension: pkg
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# target branch of release. More info https://docs.github.com/en/rest/reference/repos#releases
# in case release is created from release branch then we need to checkout from given branch
# if @semantic-release/github is used to publish, the minimum version is 7.2.0 for proper working
ref: ${{ github.event.release.target_commitish }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 14
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Get version from package.json
id: extractver
run: echo "::set-output name=version::$(npm run get-version --silent)"
- name: Install dependencies
run: npm install
- name: Assets generation
run: npm run ${{ matrix.npm_script }}
- name: Update release
uses: softprops/action-gh-release@v1
with:
files: dist/${{ matrix.dist_folder }}/asyncapi.${{ matrix.extension }}
tag_name: ${{ steps.extractver.outputs.version }}
46 changes: 33 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ CLI to work with your AsyncAPI files. Currently supports validation, but it is u

<!-- toc -->

- [Requirements](#requirements)
* [Installation](#installation)
- [Installation](#installation)
* [Using NPM and Node](#using-npm-and-node)
* [MacOS](#macos)
+ [Using brew](#using-brew)
+ [Using pkg](#using-pkg)
- [Usage](#usage)
- [Contributing](#contributing)
* [Set up development environment](#set-up-development-environment)
Expand All @@ -22,29 +25,47 @@ CLI to work with your AsyncAPI files. Currently supports validation, but it is u

<!-- tocstop -->

## Requirements
## Installation

### Using NPM and Node

To run `@asyncapi/cli`, you'll need Node.js >=v10

Run this terminal command to check your Node.js version:
```
node -v
```

If you don't have Node.js installed or NPM, simply [install both via package manager](https://nodejs.org/en/download/package-manager/)

### Installation

Run this command to install the CLI globally on your system:
> If you don't have Node.js installed or NPM, simply [install both via package manager](https://nodejs.org/en/download/package-manager/)
Install the CLI globaly on your system run CLI it from anywhere:
```
npm install -g @asyncapi/cli
```

This installs the cli globaly on your system allowing you to run it from anywhere. If you want to install it locally, just remove the `-g` flag.
### MacOS

#### Using brew

> Cli will be available for installation brew and other app managers for other systems.
You can install this CLI using [`brew`](https://brew.sh/) package manager.

```bash
# Install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install AsyncAPI CLI
brew install asyncapi
```

#### Using pkg

Each release of CLI produces a MacOS dedicated `pkg` file that enables you to install this CLI as MacOS application.

```bash
# Download latest release. To download specific release, your link should look similar to https://github.com/asyncapi/cli/releases/download/v0.13.0/asyncapi.pkg. All releases are listed in https://github.com/asyncapi/cli/releases
curl -OL https://github.com/asyncapi/cli/releases/latest/download/asyncapi.pkg
# Install AsyncAPI CLI
sudo installer -pkg asyncapi.pkg -target /
```

## Usage

Expand Down Expand Up @@ -72,8 +93,6 @@ COMMANDS
validate validate asyncapi file
```



## Contributing

Read [CONTRIBUTING](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md) guide.
Expand All @@ -83,7 +102,8 @@ Read [CONTRIBUTING](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING
Follow these steps:
- Clone the repo.
- Run `npm install` to install all the required dependencies
- Run `npm run test` to make sure everything is properly set up.
- Run `npm run test` to make sure everything is properly set up
- Run `npm run build` and then `bin/run` to try new CLI locally

UX developed for the CLI should be compliant with [Command Line Interface Guideline](https://clig.dev/)

Expand Down
Loading

0 comments on commit 706c875

Please sign in to comment.