Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Jul 14, 2021
1 parent f8d8781 commit 52535c4
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,25 @@ on:
push:
branches:
- main
schedule:
- cron: "0 7 * * *"

jobs:

test-smoke:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Install Camel K
uses: ./

- name: Test
shell: bash
run: |
kamel version
test-default:
strategy:
matrix:
Expand All @@ -22,6 +38,8 @@ jobs:

- name: Install Camel K
uses: ./
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"

- name: Test
shell: bash
Expand All @@ -36,8 +54,8 @@ jobs:
- macos-latest
- windows-latest
version:
- v1.2.0
- v1.1.1
- v1.5.0
- v1.4.1
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ branding:
inputs:
version:
description: "The Camel K version to use (default: latest)"
github_token:
description: "The Github token used to retrieve latest release from Github"
runs:
using: "node12"
main: "main.js"
28 changes: 26 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ set -o errexit
set -o nounset
set -o pipefail

set -x

DEFAULT_VERSION=latest

show_help() {
Expand All @@ -30,7 +32,8 @@ EOF

main() {
local version="$DEFAULT_VERSION"

local github_token=

parse_command_line "$@"

install_camel_k
Expand All @@ -54,6 +57,16 @@ parse_command_line() {
exit 1
fi
;;
--github-token)
if [[ -n "${2:-}" ]]; then
github_token="$2"
shift
else
echo "ERROR: '--github-token' cannot be empty." >&2
show_help
exit 1
fi
;;
*)
break
;;
Expand All @@ -68,7 +81,18 @@ install_camel_k() {
info=
if [[ "$version" = "latest" ]]
then
install_version=$(curl --silent "https://api.github.com/repos/apache/camel-k/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
#echo "--- $GITHUB_TOKEN ---"
#curl -H "Authorization: $GITHUB_TOKEN" --silent "https://api.github.com/repos/apache/camel-k/releases/latest"
#echo "----"
#curl --silent "https://api.github.com/repos/apache/camel-k/releases/latest"
#curl --silent "https://api.github.com/repos/apache/camel-k/releases/latest" | grep '"tag_name":'
#curl --silent "https://api.github.com/repos/apache/camel-k/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
if [[ -z "$github_token" ]]
then
install_version=$(curl --silent "https://api.github.com/repos/apache/camel-k/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
else
install_version=$(curl -H "Authorization: $github_token" --silent "https://api.github.com/repos/apache/camel-k/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
fi
info="=$install_version"
fi
os=$(get_os)
Expand Down
4 changes: 4 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ main() {
args+=(--version "${INPUT_VERSION}")
fi

if [[ -n "${INPUT_GITHUB_TOKEN:-}" ]]; then
args+=(--github-token "${INPUT_GITHUB_TOKEN}")
fi

if [[ ${#args[@]} -eq 0 ]]
then
"$SCRIPT_DIR/install.sh"
Expand Down

0 comments on commit 52535c4

Please sign in to comment.