Update: Revise README to clarify usage and enhance examples for GitHub Release Action
All checks were successful
Test Action / test (push) Successful in 5s
All checks were successful
Test Action / test (push) Successful in 5s
This commit is contained in:
62
README.md
62
README.md
@@ -1,37 +1,71 @@
|
|||||||
# Setup GitHub Release Action
|
# Setup GitHub Release Action
|
||||||
|
|
||||||
This GitHub/Gitea Action downloads a tool from a GitHub release based on platform-aware selection rules and adds it to the system PATH.
|
This GitHub/Gitea Action downloads a tool from a GitHub release, extracts it, automatically finds the executable, and adds it to the system PATH. It supports platform-aware selection, recursive binary search, and tool caching.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Automatic Platform Detection**: Detects OS and Architecture to find the right asset.
|
||||||
|
- **Recursive Binary Search**: Finds the executable even if it's nested deep inside an archive.
|
||||||
|
- **Tool Caching**: Uses the standard runner tool cache to speed up subsequent runs.
|
||||||
|
- **Flexible Matching**: Supports literal names, regex patterns, and custom file types.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Simple (Automatic Selection)
|
### Simple (Automatic Selection)
|
||||||
The action will automatically detect your OS and ARCH and look for a matching archive.
|
|
||||||
|
The action will automatically detect your OS (Linux, Windows, macOS) and architecture (x64, ARM64) and look for a matching archive. It will search for a binary named after the repository.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: ./
|
- name: Install Hugo
|
||||||
|
uses: koszewscy/setup-github-release@v1
|
||||||
with:
|
with:
|
||||||
repo-name: 'gohugoio/hugo'
|
repo-name: 'go-acme/lego'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Regex Search
|
> **Note:** RClone is an example of a project that provides a binary in a subdirectory inside the archive. The action will find it automatically.
|
||||||
You can use a regex pattern (prefixed with `~`) to narrow down the asset.
|
|
||||||
|
### Advanced Asset Selection
|
||||||
|
|
||||||
|
For projects with multiple binary versions, you can use a regex pattern (prefixed with `~`) to narrow down the asset. Hugo is an example where you have to choose between one of the three versions: standard, extended, or extended with deploy support.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: ./
|
- name: Install Extended Hugo
|
||||||
|
uses: koszewscy/setup-github-release@v1
|
||||||
with:
|
with:
|
||||||
repo-name: 'gohugoio/hugo'
|
repo-name: 'gohugoio/hugo'
|
||||||
file-name: '~hugo_extended'
|
file-name: '~hugo_extended_[^a-z]' # Regex to match extended version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Custom File Type
|
### Specific Binary Finding
|
||||||
|
|
||||||
|
If the binary name is different from the repository name, like in the example of GitHub CLI, you can specify the `binary-name` input to locate the correct executable inside the downloaded asset:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: ./
|
- name: Install GitHub CLI
|
||||||
|
uses: koszewscy/setup-github-release@v1
|
||||||
with:
|
with:
|
||||||
repo-name: 'some/repo'
|
repo-name: 'cli/cli'
|
||||||
file-type: 'package' # Matches .deb, .rpm, .pkg
|
binary-name: 'gh' # Searches for 'gh' (or 'gh.exe') inside the extracted release
|
||||||
|
```
|
||||||
|
|
||||||
|
### Debugging Archive Content
|
||||||
|
|
||||||
|
If you are unsure how the binary is named, use the `debug` flag to list all files in the unpacked asset, or download the asset manually to inspect its structure.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: koszewscy/setup-github-release@v1
|
||||||
|
with:
|
||||||
|
repo-name: 'owner/repo'
|
||||||
|
debug: true
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
- `repo-name` (required): GitHub repository in `owner/repo` format.
|
- `repo-name` (required): GitHub repository in `owner/repo` format.
|
||||||
- `file-name` (optional): Literal name or regex pattern (if starts with `~`) to match the asset.
|
- `file-name` (optional): Literal name or regex pattern (if starts with `~`) to match the asset.
|
||||||
- `file-type` (optional, default: `archive`): Predefined keywords `archive`, `package`, or a custom regex extension pattern.
|
- `binary-name` (optional): The name or regex pattern (if starts with `~`) of the binary to find. Defaults to the repository name.
|
||||||
- `token` (optional): GitHub token for authentication.
|
- `file-type` (optional, default: `archive`): Predefined keywords `archive`, `package`, or a custom regex pattern.
|
||||||
|
- `debug` (optional, default: `false`): Set to `true` to log the contents of the unpacked asset.
|
||||||
|
- `token` (optional): GitHub token for authentication (defaults to `${{ github.token }}` that is an equivalent of `${{ secrets.GITHUB_TOKEN }}`). Use `${{ secrets.GITEA_TOKEN }}` for Gitea, or create a personal access token.
|
||||||
|
|
||||||
|
> **Important:** Default authentication will will only work if the action is used within GitHub workflow. For Gitea, you must provide a token explicitly.
|
||||||
Reference in New Issue
Block a user