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

chore(v1.1): Support nightly releases #1

Merged
merged 1 commit into from
Aug 21, 2023
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
15 changes: 9 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Test

on:
workflow_dispatch:
pull_request:
push:
branches:
Expand All @@ -14,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Install YAKS
uses: ./
Expand All @@ -24,7 +25,7 @@ jobs:
run: |
yaks version
test-default:
test-latest:
strategy:
matrix:
os:
Expand All @@ -34,7 +35,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Install YAKS
uses: ./
Expand All @@ -46,19 +47,21 @@ jobs:
run: |
yaks version
test-with-custom-version:
test-custom-version:
strategy:
matrix:
os:
- ubuntu-latest
- 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:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.iml
.idea
.project
.settings
Expand Down
57 changes: 52 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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/[email protected]
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/[email protected]
with:
version: nightly
```

This will use the latest available nightly snapshot version of YAKS.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
21 changes: 20 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ EOF
main() {
local version="$DEFAULT_VERSION"
local github_token=

parse_command_line "$@"

install_yaks
Expand Down Expand Up @@ -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
Expand Down