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

Fix gh actions #823

Merged
merged 1 commit into from
Oct 25, 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
2 changes: 1 addition & 1 deletion .github/workflows/test-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
sparse-checkout: |
action.yaml
- name: Set up kwokctl
uses: . # kubernetes-sigs/kwok@main
uses: ./ # kubernetes-sigs/kwok@main
with:
command: kwokctl
- name: Test kwokctl
Expand Down
36 changes: 24 additions & 12 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,41 @@ inputs:
repository:
required: false
description: Repository is kwok's repository, will use release from this repository, defaults same as uses in this step
default: "kubernetes-sigs/kwok"

runs:
using: composite
steps:
- name: Install ${{ inputs.command }}
shell: bash
env:
KWOK_REPO: ${{ inputs.repository || github.repository }}
KWOK_REPO: ${{ inputs.repository }}
KWOK_VERSION: ${{ inputs.kwok-version }}
run: |
if [[ ! -f /usr/local/bin/${{ inputs.command }}-${KWOK_VERSION} ]]; then
if [[ -f /usr/local/bin/${{ inputs.command }} ]]; then
echo "Found ${{ inputs.command }} in /usr/local/bin, skipping installation"
exit 0
fi

if [[ -z "${KWOK_VERSION}" ]]; then
echo "Fetching latest version..."
KWOK_VERSION="$(curl "https://api.github.com/repos/${KWOK_REPO}/releases/latest" | jq -r '.tag_name')"
if [[ -z "${KWOK_VERSION}" ]]; then
echo "Fetching latest version..."
KWOK_VERSION="$(curl "https://api.github.com/repos/${KWOK_REPO}/releases/latest" | jq -r '.tag_name')"
echo "Latest version is ${KWOK_VERSION}"
echo "Failed to fetch latest version"
exit 1
fi
echo "Installing ${{ inputs.command }} ${KWOK_VERSION}..."
wget -O ${{ inputs.command }}-${KWOK_VERSION} "https://github.com/${KWOK_REPO}/releases/download/${KWOK_VERSION}/${{ inputs.command }}-$(go env GOOS)-$(go env GOARCH)"
chmod +x ${{ inputs.command }}-${KWOK_VERSION}
sudo mv ${{ inputs.command }}-${KWOK_VERSION} /usr/local/bin/
sudo ln -sf /usr/local/bin/${{ inputs.command }}-${KWOK_VERSION} /usr/local/bin/${{ inputs.command }}
if ! ${{ inputs.command }} --version; then
echo "Failed to run ${{ inputs.command }} --version"
if [[ "${KWOK_VERSION}" == "null" ]]; then
echo "Failed to fetch latest version"
exit 1
fi
echo "Latest version is ${KWOK_VERSION}"
fi

echo "Installing ${{ inputs.command }} ${KWOK_VERSION}..."
wget -O ${{ inputs.command }} "https://github.com/${KWOK_REPO}/releases/download/${KWOK_VERSION}/${{ inputs.command }}-$(go env GOOS)-$(go env GOARCH)"
chmod +x ${{ inputs.command }}
sudo mv ${{ inputs.command }} /usr/local/bin/
if ! ${{ inputs.command }} --version; then
echo "Failed to run ${{ inputs.command }} --version"
exit 1
fi
Loading