Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 53 additions & 13 deletions actions/setup-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
# Setup gh-aw CLI Action

This GitHub Action installs the `gh-aw` CLI extension for a specific version using release tags.
This GitHub Action installs the `gh-aw` CLI extension using the latest stable release, an exact release tag, or a major-version channel.

## Features

- ✅ **Version validation**: Ensures the specified version exists as a release
- ✅ **Flexible versions**: Supports latest, exact release tags, and major-version channels
- ✅ **Checksum verification**: Validates SHA256 checksums for downloaded binaries
- ✅ **Automatic fallback**: Tries `gh extension install` first, falls back to direct download if needed
- ✅ **Cross-platform**: Works on Linux, macOS, Windows, and FreeBSD
- ✅ **Multi-architecture**: Supports amd64, arm64, 386, and arm architectures

## Usage

### Basic Usage
### Install Latest Stable Release

Omit `version` to install the latest stable release:

```yaml
- uses: github/gh-aw/actions/setup-cli@main
```

### Install a Major-Version Channel

Use a `vN` channel to install the highest stable SemVer release in that major:

```yaml
- uses: github/gh-aw/actions/setup-cli@main
with:
version: v1
```

Major-version channels are preparatory until stable releases exist for those majors. There is no stable `v1` release yet, so `v1` currently fails with a clear error. The `v0` channel can resolve to the existing stable `v0.x` release line.

### Install an Exact Release Tag

```yaml
- name: Install gh-aw
Expand Down Expand Up @@ -48,11 +68,16 @@ jobs:

## Inputs

### `version` (required)
### `version` (optional)

The version of gh-aw to install. Must be a release tag.
The version selector for gh-aw.

- **Release tag**: e.g., `v0.37.18`, `v0.37.0`
- **Default**: `latest`
- **Latest**: Selects the latest stable release overall
- **Major-version channel**: `vN`, e.g. `v0` or `v1`, selects the highest stable SemVer release in that major
- **Release tag**: e.g., `v0.37.18`, installs that exact release

Prereleases are not selected by `latest` or a major-version channel. A channel without a stable release fails; for example, `v1` has no matching release yet.

### `github-token` (optional)

Expand All @@ -70,12 +95,11 @@ The version tag that was actually installed.

## How It Works

1. **Version validation**: Validates the input is a valid release tag
2. **Release verification**: Validates that the release exists on GitHub
3. **Primary installation method**: Attempts to install using `gh extension install github/gh-aw`
4. **Fallback method**: If primary method fails, downloads the binary directly from GitHub releases
5. **Checksum verification**: Downloads and verifies SHA256 checksums for the binary
6. **Binary verification**: Ensures the installed binary works correctly
1. **Version resolution**: Resolves `latest` or a `vN` channel to a stable release tag; exact tags are kept unchanged
2. **Primary installation method**: Attempts to install using `gh extension install github/gh-aw`
3. **Fallback method**: If primary method fails, downloads the binary directly from GitHub releases
4. **Checksum verification**: Downloads and verifies SHA256 checksums for the binary
5. **Binary verification**: Ensures the installed binary works correctly

## Requirements

Expand All @@ -86,8 +110,8 @@ The version tag that was actually installed.

The action will fail if:

- No version is provided
- The specified release tag doesn't exist
- A major-version channel has no stable release
- The binary download fails
- The downloaded binary is not executable or doesn't work

Expand All @@ -110,6 +134,22 @@ The action will fail if:
version: v0.37.18
```

### Install Latest Stable Release

```yaml
- uses: github/gh-aw/actions/setup-cli@main
```

### Install a Major-Version Channel

```yaml
- uses: github/gh-aw/actions/setup-cli@main
with:
version: v1
```

`v1` is an example of a forward-looking channel and will work once a stable v1 release is published. Use `v0` for the existing stable v0 release line.

### Use Output

```yaml
Expand Down
7 changes: 4 additions & 3 deletions actions/setup-cli/action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: 'Setup gh-aw CLI'
description: 'Install gh-aw CLI extension for a specific version'
description: 'Install gh-aw CLI extension using latest, an exact tag, or a major-version channel'
author: 'GitHub Next'

inputs:
version:
description: 'Version to install (release tag like v0.37.18)'
required: true
description: 'Version to install: latest, a release tag like v0.37.18, or a major-version channel like v1'
required: false
default: latest
github-token:
description: 'GitHub token for authentication (used for gh CLI and API calls)'
required: false
Expand Down
79 changes: 78 additions & 1 deletion actions/setup-cli/install.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

160 changes: 159 additions & 1 deletion actions/setup-cli/install.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading