Skip to content

Commit

Permalink
Add 'latest' version alias (#42)
Browse files Browse the repository at this point in the history
Allow a user to specify the cmake-version as `latest` instead of an
empty string to help clarity in workflow files.
  • Loading branch information
jwlawson authored Jan 14, 2022
1 parent 73bc9c3 commit e95fd2a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
pull_request:
branches: [master]

jobs:
latest_version:
runs-on: ${{ matrix.os }}
name: Test latest version
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Setup cmake
uses: ./
id: setup
with:
cmake-version: 'latest'

- name: Run cmake --version
shell: bash
run: |
VERSION=`cmake --version`
echo $VERSION
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.9
uses: jwlawson/actions-setup-cmake@v1.10
with:
cmake-version: '3.16.x'
- name: Use cmake
Expand All @@ -32,6 +32,9 @@ There are three options for the action:
version `3.2.x`. By default it is empty which will give the latest CMake
version available on GitHub.

The version can also be specified to be `latest` which is equivalent to
leaving it blank and will give the latest version.

The [version tests] show some expected values for given versions.

* `github-api-token` is optional, but is used to authenticate with GitHub's
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "actions-setup-cmake",
"version": "1.9.0",
"version": "1.10.0",
"description": "GitHub action to setup cmake",
"main": "dist/index.js",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import * as version from './version';

async function run() {
try {
const required_version = core.getInput('cmake-version');
const requested_version = core.getInput('cmake-version');
const required_version =
requested_version === 'latest' ? '' : requested_version;
const api_token = core.getInput('github-api-token');
const all_version_info = await version.getAllVersionInfo(api_token);
const chosen_version_info = version.getLatestMatching(
Expand Down

0 comments on commit e95fd2a

Please sign in to comment.