Update: Renmaed input repo-name to repository.
This commit is contained in:
@@ -11,20 +11,20 @@ jobs:
|
|||||||
- name: Go ACME Setup
|
- name: Go ACME Setup
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
repo-name: 'go-acme/lego'
|
repository: 'go-acme/lego'
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
repo-name: 'gohugoio/hugo'
|
repository: 'gohugoio/hugo'
|
||||||
file-name: '~hugo_extended_[^a-z]'
|
file-name: '~hugo_extended_[^a-z]'
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
- name: Setup RClone
|
- name: Setup RClone
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
repo-name: 'rclone/rclone'
|
repository: 'rclone/rclone'
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
- name: Verify Installation
|
- name: Verify Installation
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -19,7 +19,7 @@ The action will automatically detect your OS (Linux, Windows, macOS) and archite
|
|||||||
- name: Install Hugo
|
- name: Install Hugo
|
||||||
uses: koszewscy/setup-github-release@v1
|
uses: koszewscy/setup-github-release@v1
|
||||||
with:
|
with:
|
||||||
repo-name: 'go-acme/lego'
|
repository: 'go-acme/lego'
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note:** RClone is an example of a project that provides a binary in a subdirectory inside the archive. The action will find it automatically.
|
> **Note:** RClone is an example of a project that provides a binary in a subdirectory inside the archive. The action will find it automatically.
|
||||||
@@ -32,7 +32,7 @@ For projects with multiple binary versions, you can use a regex pattern (prefixe
|
|||||||
- name: Install Extended Hugo
|
- name: Install Extended Hugo
|
||||||
uses: koszewscy/setup-github-release@v1
|
uses: koszewscy/setup-github-release@v1
|
||||||
with:
|
with:
|
||||||
repo-name: 'gohugoio/hugo'
|
repository: 'gohugoio/hugo'
|
||||||
file-name: '~hugo_extended_[^a-z]' # Regex to match extended version
|
file-name: '~hugo_extended_[^a-z]' # Regex to match extended version
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ If the binary name is different from the repository name, like in the example of
|
|||||||
- name: Install GitHub CLI
|
- name: Install GitHub CLI
|
||||||
uses: koszewscy/setup-github-release@v1
|
uses: koszewscy/setup-github-release@v1
|
||||||
with:
|
with:
|
||||||
repo-name: 'cli/cli'
|
repository: 'cli/cli'
|
||||||
binary-name: 'gh' # Searches for 'gh' (or 'gh.exe') inside the extracted release
|
binary-name: 'gh' # Searches for 'gh' (or 'gh.exe') inside the extracted release
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -55,13 +55,13 @@ If you are unsure how the binary is named, use the `debug` flag to list all file
|
|||||||
```yaml
|
```yaml
|
||||||
- uses: koszewscy/setup-github-release@v1
|
- uses: koszewscy/setup-github-release@v1
|
||||||
with:
|
with:
|
||||||
repo-name: 'owner/repo'
|
repository: 'owner/repo'
|
||||||
debug: true
|
debug: true
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
- `repo-name` (required): GitHub repository in `owner/repo` format.
|
- `repository` (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.
|
||||||
- `binary-name` (optional): The name or regex pattern (if starts with `~`) of the binary to find. Defaults to the repository name.
|
- `binary-name` (optional): The name or regex pattern (if starts with `~`) of the binary to find. Defaults to the repository name.
|
||||||
- `file-type` (optional, default: `archive`): Predefined keywords `archive`, `package`, or a custom regex pattern.
|
- `file-type` (optional, default: `archive`): Predefined keywords `archive`, `package`, or a custom regex pattern.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: 'setup-github-release'
|
|||||||
description: 'Install a tool from a GitHub release and add it to the PATH'
|
description: 'Install a tool from a GitHub release and add it to the PATH'
|
||||||
author: 'Slawomir Koszewski with GitHub Copilot assistance'
|
author: 'Slawomir Koszewski with GitHub Copilot assistance'
|
||||||
inputs:
|
inputs:
|
||||||
repo-name:
|
repository:
|
||||||
description: 'The GitHub repository name (e.g., owner/repo)'
|
description: 'The GitHub repository name (e.g., owner/repo)'
|
||||||
required: true
|
required: true
|
||||||
file-name:
|
file-name:
|
||||||
|
|||||||
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -36,7 +36,7 @@ function findBinary(dir: string, pattern: string | RegExp, debug: boolean): stri
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const repoName = core.getInput('repo-name', { required: true });
|
const repository = core.getInput('repository', { required: true });
|
||||||
let fileName = core.getInput('file-name');
|
let fileName = core.getInput('file-name');
|
||||||
const binaryInput = core.getInput('binary-name');
|
const binaryInput = core.getInput('binary-name');
|
||||||
const fileType = core.getInput('file-type') || 'archive';
|
const fileType = core.getInput('file-type') || 'archive';
|
||||||
@@ -70,7 +70,7 @@ async function run() {
|
|||||||
extPattern = fileType;
|
extPattern = fileType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `https://api.github.com/repos/${repoName}/releases/latest`;
|
const url = `https://api.github.com/repos/${repository}/releases/latest`;
|
||||||
const headers: Record<string, string> = {
|
const headers: Record<string, string> = {
|
||||||
'Accept': 'application/vnd.github.v3+json',
|
'Accept': 'application/vnd.github.v3+json',
|
||||||
'User-Agent': 'setup-github-release-action'
|
'User-Agent': 'setup-github-release-action'
|
||||||
@@ -79,7 +79,7 @@ async function run() {
|
|||||||
headers['Authorization'] = `token ${token}`;
|
headers['Authorization'] = `token ${token}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`Fetching latest release information for ${repoName}...`);
|
core.info(`Fetching latest release information for ${repository}...`);
|
||||||
const response = await fetch(url, { headers });
|
const response = await fetch(url, { headers });
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch release: ${response.statusText} (${response.status})`);
|
throw new Error(`Failed to fetch release: ${response.statusText} (${response.status})`);
|
||||||
@@ -141,7 +141,7 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const version = data.tag_name.replace(/^v/, '');
|
const version = data.tag_name.replace(/^v/, '');
|
||||||
const toolName = repoName.split('/').pop() || repoName;
|
const toolName = repository.split('/').pop() || repository;
|
||||||
const binaryName = binaryInput || toolName;
|
const binaryName = binaryInput || toolName;
|
||||||
|
|
||||||
// Check if the tool is already in the cache
|
// Check if the tool is already in the cache
|
||||||
|
|||||||
Reference in New Issue
Block a user