mirror of
https://github.com/Luzifer/github-publish.git
synced 2024-11-09 23:00:14 +00:00
Add first version of docker2aci builder
This commit is contained in:
parent
08f9f67c58
commit
61d11e6832
2 changed files with 61 additions and 0 deletions
|
@ -1 +1,2 @@
|
|||
9885fdbc80deb95c4f15c52983b812fca7c06cbe2a02db893e0786638922bcad docker2aci.sh
|
||||
baae3f7cfe082d64882bdc2ec914962434f88bf18985ec0accdb74f36c6cb645 golang.sh
|
||||
|
|
60
docker2aci.sh
Normal file
60
docker2aci.sh
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o pipefail
|
||||
|
||||
curl -sL https://raw.githubusercontent.com/Luzifer/github-publish/master/SHA256SUMS | \
|
||||
grep "docker2aci.sh" | sha256sum -c || exit 2
|
||||
|
||||
VERSION=$(git describe --tags --exact-match)
|
||||
PWD=$(pwd)
|
||||
REPO=${REPO:-$(basename ${PWD})}
|
||||
DOCKERFILE_PATH=${DOCKERFILE_PATH:-.}
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "${VERSION}" ]; then
|
||||
echo "No tag present, stopping build now."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${GITHUB_TOKEN}" ]; then
|
||||
echo "Please set \$GITHUB_TOKEN environment variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${REPO}" ]; then
|
||||
echo "Please set \$REPO environment variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${GHUSER}" ]; then
|
||||
echo "Please set \$GHUSER environment variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOCKER_IMAGE="${GHUSER,,}/${REPO,,}:${VERSION,,}"
|
||||
ACIMAGE="${GHUSER,,}-${REPO,,}-${VERSION,,}.aci"
|
||||
|
||||
set -x
|
||||
|
||||
# Retrieve dependencies
|
||||
curl -sL https://github.com/appc/docker2aci/releases/download/v0.14.0/docker2aci-v0.14.0.tar.gz | \
|
||||
tar -xvz -f - --wildcards --strip-components=1 '*/docker2aci'
|
||||
|
||||
docker build -t "${GHUSER}/${REPO}:${VERSION}" ${DOCKERFILE_PATH}
|
||||
docker save -o build.docker "${GHUSER}/${REPO}:${VERSION}"
|
||||
|
||||
./docker2aci build.docker
|
||||
|
||||
# TODO: Sign release
|
||||
|
||||
sha256sum ${ACIMAGE} > SHA256SUMS
|
||||
|
||||
# Create a drafted release
|
||||
github-release release --user ${GHUSER} --repo ${REPO} --tag ${VERSION} --name ${VERSION} --draft || true
|
||||
|
||||
# Upload build assets
|
||||
for file in ${ACIMAGE} SHA256SUMS; do
|
||||
github-release upload --user ${GHUSER} --repo ${REPO} --tag ${VERSION} --name ${file} --file ${file}
|
||||
done
|
||||
|
Loading…
Reference in a new issue