mirror of
https://github.com/fluxcd/flux2.git
synced 2025-05-20 14:16:21 +08:00
Quote tested values in fluxcd/flux GitHub Action
Fix an issue with improperly quoted variables created by #3474 Also, curl should fail with an error code if the download results in 404 not found * + (x3) Update action/action.yml * for consistent format Co-authored-by: Steven E. Harris <seh@panix.com> Signed-off-by: Kingdon Barrett <kingdon@weave.works>
This commit is contained in:
@ -28,23 +28,23 @@ runs:
|
|||||||
VERSION=${{ inputs.version }}
|
VERSION=${{ inputs.version }}
|
||||||
TOKEN=${{ inputs.token }}
|
TOKEN=${{ inputs.token }}
|
||||||
|
|
||||||
if [ -n $TOKEN ]; then
|
if [ -n "${TOKEN}" ]; then
|
||||||
TOKEN=(-H "Authorization: token $TOKEN")
|
TOKEN=(-H "Authorization: token ${TOKEN}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z $VERSION ]; then
|
if [ -z "${VERSION}" ]; then
|
||||||
VERSION=$(curl https://api.github.com/repos/fluxcd/flux2/releases/latest -sL "${TOKEN[@]}" | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
|
VERSION=$(curl https://api.github.com/repos/fluxcd/flux2/releases/latest -sL "${TOKEN[@]}" | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BIN_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_${ARCH}.tar.gz"
|
BIN_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_${ARCH}.tar.gz"
|
||||||
curl -sL ${BIN_URL} -o /tmp/flux.tar.gz
|
curl --silent --fail --location "${BIN_URL}" --output /tmp/flux.tar.gz
|
||||||
mkdir -p /tmp/flux
|
mkdir -p /tmp/flux
|
||||||
tar -C /tmp/flux/ -zxvf /tmp/flux.tar.gz
|
tar -C /tmp/flux/ -zxvf /tmp/flux.tar.gz
|
||||||
- name: "Copy Flux binary to execute location"
|
- name: "Copy Flux binary to execute location"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
BINDIR=${{ inputs.bindir }}
|
BINDIR=${{ inputs.bindir }}
|
||||||
if [ -z $BINDIR ]; then
|
if [ -z "${BINDIR}" ]; then
|
||||||
sudo cp /tmp/flux/flux /usr/local/bin
|
sudo cp /tmp/flux/flux /usr/local/bin
|
||||||
else
|
else
|
||||||
cp /tmp/flux/flux "${BINDIR}"
|
cp /tmp/flux/flux "${BINDIR}"
|
||||||
|
Reference in New Issue
Block a user