Upload to assets to GitHub
This commit is contained in:
parent
7b998239af
commit
9b66bc2f13
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -x
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
if [[ "$TRAVIS_SECURE_ENV_VARS" != "true" ]]
|
||||||
|
then
|
||||||
|
echo >&2 "Missing TRAVIS_SECURE_ENV_VARS. Skipping GitHub deployment."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
install_deps() {
|
||||||
|
version="2.7.0" # 2.14.1 fails to overwrite duplicates
|
||||||
|
case "$(uname)" in
|
||||||
|
Linux)
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install curl
|
||||||
|
curl -L "https://github.com/github/hub/releases/download/v$version/hub-linux-amd64-$version.tgz" | tar xvz --strip-components=1 "hub-linux-amd64-$version/bin/hub"
|
||||||
|
;;
|
||||||
|
Darwin)
|
||||||
|
curl -L "https://github.com/github/hub/releases/download/v$version/hub-darwin-amd64-$version.tgz" | tar xvz --strip-components=1 "hub-darwin-amd64-$version/bin/hub"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown: $(uname)"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
hub_path="$PWD/bin/hub"
|
||||||
|
hub() {
|
||||||
|
"$hub_path" "$@"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
install_deps
|
||||||
|
|
||||||
|
export EDITOR="touch"
|
||||||
|
|
||||||
|
# Sanity check
|
||||||
|
hub release show latest || exit 1
|
||||||
|
|
||||||
|
for tag in $TAGS
|
||||||
|
do
|
||||||
|
if ! hub release show "$tag"
|
||||||
|
then
|
||||||
|
echo "Creating new release $tag"
|
||||||
|
git show --no-patch --format='format:%B' > description
|
||||||
|
hub release create -F description "$tag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
files=()
|
||||||
|
for file in deploy/*
|
||||||
|
do
|
||||||
|
[[ $file == *.@(xz|gz|zip) ]] || continue
|
||||||
|
files+=(-a "$file")
|
||||||
|
done
|
||||||
|
hub release edit "${files[@]}" "$tag" || exit 1
|
||||||
|
done
|
||||||
|
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
before_install: |
|
before_install: |
|
||||||
DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
|
||||||
DOCKER_BUILDS=""
|
DOCKER_BUILDS=""
|
||||||
TAGS=""
|
export TAGS=""
|
||||||
test "$TRAVIS_BRANCH" = master && TAGS="$TAGS latest" || true
|
test "$TRAVIS_BRANCH" = master && TAGS="$TAGS latest" || true
|
||||||
test -n "$TRAVIS_TAG" && TAGS="$TAGS stable $TRAVIS_TAG" || true
|
test -n "$TRAVIS_TAG" && TAGS="$TAGS stable $TRAVIS_TAG" || true
|
||||||
echo "Tags are $TAGS"
|
echo "Tags are $TAGS"
|
||||||
|
@ -36,6 +36,7 @@ script:
|
||||||
- ./striptests
|
- ./striptests
|
||||||
- set -ex; build_"$BUILD"; set +x;
|
- set -ex; build_"$BUILD"; set +x;
|
||||||
- ./.prepare_deploy
|
- ./.prepare_deploy
|
||||||
|
- ./.github_deploy
|
||||||
|
|
||||||
after_failure: |
|
after_failure: |
|
||||||
id
|
id
|
||||||
|
@ -54,5 +55,5 @@ deploy:
|
||||||
local_dir: deploy
|
local_dir: deploy
|
||||||
on:
|
on:
|
||||||
repo: koalaman/shellcheck
|
repo: koalaman/shellcheck
|
||||||
condition: $TRAVIS_BUILD_STAGE_NAME = Test
|
condition: $TRAVIS_BUILD_STAGE_NAME = "Build binaries"
|
||||||
all_branches: true
|
all_branches: true
|
||||||
|
|
|
@ -11,8 +11,8 @@ RUN set -x; \
|
||||||
if [ "${arch}" = 'armv7l' ]; then \
|
if [ "${arch}" = 'armv7l' ]; then \
|
||||||
arch='armv6hf'; \
|
arch='armv6hf'; \
|
||||||
fi; \
|
fi; \
|
||||||
url_base='https://shellcheck.storage.googleapis.com/'; \
|
url_base='https://github.com/koalaman/shellcheck/releases/download/'; \
|
||||||
tar_file="shellcheck-${tag}.linux.${arch}.tar.xz"; \
|
tar_file="${tag}/shellcheck-${tag}.linux.${arch}.tar.xz"; \
|
||||||
wget "${url_base}${tar_file}" -O - | tar xJf -; \
|
wget "${url_base}${tar_file}" -O - | tar xJf -; \
|
||||||
mv "shellcheck-${tag}/shellcheck" /bin/; \
|
mv "shellcheck-${tag}/shellcheck" /bin/; \
|
||||||
rm -rf "shellcheck-${tag}"; \
|
rm -rf "shellcheck-${tag}"; \
|
||||||
|
|
Loading…
Reference in New Issue