Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find latest version for GitHub release assets #129

Merged
merged 6 commits into from
Dec 2, 2024
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
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ jobs:
run: ls -l '${{ steps.setup-hlint.outputs.file }}'
- run: hlint --version

# Same, with inferred version
- id: setup-hlint-latest
uses: ./
with:
name: "hlint"
url: "https://github.com/ndmitchell/{name}/releases/download/v{version}/{name}-{version}-{arch}-{os}.{ext}"
subdir: "{name}-{version}"
os-darwin: osx
os-win32: windows
arch: x86_64
- run: ls -l '${{ steps.setup-hlint-latest.outputs.directory }}'
- if: ${{ matrix.runner != 'windows-latest' }} # it's .exe on win32
run: ls -l '${{ steps.setup-hlint-latest.outputs.file }}'
- run: hlint --version

- id: setup-dms
uses: ./
with:
Expand Down Expand Up @@ -89,6 +104,16 @@ jobs:
- if: ${{ matrix.runner == 'ubuntu-latest' }}
run: bluebook --help

# Test inferring "latest"
- if: ${{ matrix.runner == 'ubuntu-latest' }}
uses: ./
with:
name: bluebook
url: "https://github.com/pbrisbin/{name}/releases/download/v{version}/{name}-{os}-{arch}"
no-extract: "true"
- if: ${{ matrix.runner == 'ubuntu-latest' }}
run: bluebook --help

#
# Random example from Freckle, that's a private repo. TODO: skip in
# forks.
Expand Down
153 changes: 88 additions & 65 deletions README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions action-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ inputs:
github-token:
type: string

github-token-for-latest:
type: string

outputs:
directory:
type: string
Expand Down
15 changes: 13 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ inputs:
required: true

version:
description: "Version of the tool"
required: true
description: |
Version of the tool

Required unless `url` is to a GitHub release asset, in which case the
latest release will be looked up if left blank.
required: false

url:
description: |
Expand Down Expand Up @@ -110,6 +114,13 @@ inputs:

https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset

github-token-for-latest:
description: |
Token used for looking up a latest release when `version` is blank, `url`
is to a GitHub release asset, and `github-token` is not set. This is to
avoid rate limits when interacting with public releases.
default: ${{ github.token }}

outputs:
directory:
description: Directory that was added to `$PATH` as result of setup.
Expand Down
Loading
Loading