diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0137601..8dc707f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,6 +1,7 @@ name: Test on: + workflow_dispatch: pull_request: push: branches: @@ -14,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Install YAKS uses: ./ @@ -24,7 +25,7 @@ jobs: run: | yaks version - test-default: + test-latest: strategy: matrix: os: @@ -34,7 +35,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Install YAKS uses: ./ @@ -46,7 +47,7 @@ jobs: run: | yaks version - test-with-custom-version: + test-custom-version: strategy: matrix: os: @@ -54,11 +55,13 @@ jobs: - macos-latest - windows-latest version: - - v0.4.0 + - v0.15.1 + - nightly + - nightly:0.15.0-202303270035 runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Install YAKS with: diff --git a/.gitignore b/.gitignore index 8922e1a..4f60719 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*.iml .idea .project .settings diff --git a/README.md b/README.md index 4d4aa91..a3c2e29 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# YAKS Tools Action +# YAKS Install Action -[![](https://github.com/citrusframework/yaks-action/workflows/Test/badge.svg?branch=main)](https://github.com/citrusframework/yaks-action/actions) +[![](https://github.com/citrusframework/yaks-install-action/workflows/Test/badge.svg?branch=main)](https://github.com/citrusframework/yaks-install-action/actions) A GitHub Action for installing and using YAKS client tools. @@ -31,8 +31,55 @@ jobs: yaks: runs-on: ubuntu-latest steps: - - name: YAKS client - uses: citrusframework/yaks-action@v1 + - name: YAKS tools + uses: citrusframework/yaks-install-action@v1.1 ``` -This uses [@citrusframework/yaks-action](https://www.github.com/citrusframework/yaks-action) GitHub Action to install the YAKS client binaries. +This uses [@citrusframework/yaks-install-action](https://www.github.com/citrusframework/yaks-install-action) GitHub Action to install the YAKS client binaries. + +## Use specific version + +By default, the action will resolve the latest released version of YAKS. +You can provide a specific version to install though. + +Create a workflow (eg: `.github/workflows/create-cluster.yml`): + +```yaml +name: YAKS + +on: pull_request + +jobs: + yaks: + runs-on: ubuntu-latest + steps: + - name: YAKS tools + uses: citrusframework/yaks-install-action@v1.1 + with: + version: v0.15.1 +``` + +This will try to resolve a YAKS release tag with `v0.15.1` and use this specific version. + +## Use nightly releases + +YAKS framework provides access to nightly snapshot pre-release versions. + +Create a workflow (eg: `.github/workflows/create-cluster.yml`): + +```yaml +name: YAKS + +on: pull_request + +jobs: + yaks: + runs-on: ubuntu-latest + steps: + - name: YAKS tools + uses: citrusframework/yaks-install-action@v1.1 + with: + version: nightly +``` + +This will use the latest available nightly snapshot version of YAKS. diff --git a/action.yml b/action.yml index 1f1e4fb..cdb443b 100644 --- a/action.yml +++ b/action.yml @@ -10,5 +10,5 @@ inputs: github_token: description: "Optional token used when fetching the latest YAKS release to avoid hitting rate limits" runs: - using: "node12" + using: "node16" main: "main.js" diff --git a/install.sh b/install.sh index 8a7bff0..012e273 100755 --- a/install.sh +++ b/install.sh @@ -32,7 +32,7 @@ EOF main() { local version="$DEFAULT_VERSION" local github_token= - + parse_command_line "$@" install_yaks @@ -88,9 +88,28 @@ install_yaks() { fi info="=$install_version" fi + + if [[ "$version" = "nightly" ]] + then + if [[ -z "$github_token" ]] + then + install_version=$(curl --silent "https://api.github.com/repos/citrusframework/yaks/releases" | grep '"tag_name":' | head -1 | sed -E 's/.*"([^"]+)".*/\1/') + else + install_version=$(curl -H "Authorization: $github_token" --silent "https://api.github.com/repos/citrusframework/yaks/releases" | grep '"tag_name":' | head -1 | sed -E 's/.*"([^"]+)".*/\1/') + fi + info="=$install_version" + fi + + if [[ "$version" == "nightly:"* ]] + then + install_version=$(echo $install_version | tr -d nightly:) + fi + os=$(get_os) binary_version=$(echo $install_version | tr -d v) + echo "Loading citrusframework/yaks/releases/download/$install_version/yaks-$binary_version-$os-64bit.tar.gz" + echo "Installing YAKS client version $version$info on $os..." curl -L --silent https://github.com/citrusframework/yaks/releases/download/$install_version/yaks-$binary_version-$os-64bit.tar.gz -o yaks.tar.gz