Skip to content

Commit

Permalink
nix: nightly release gh/docker
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-chavez committed Nov 8, 2020
1 parent 764c4ee commit 356c0c7
Showing 1 changed file with 43 additions and 17 deletions.
60 changes: 43 additions & 17 deletions nix/release/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,34 @@ let
version=$1
changes="$(sed -n "1,/$version/d;/## \[/q;p" ${../../CHANGELOG.md})"
tar cvJf postgrest-$version-linux-x64-static.tar.xz \
-C ${postgrest}/bin postgrest
${ghr}/bin/ghr \
-t "$GITHUB_TOKEN" \
-u "$GITHUB_USERNAME" \
-r "$GITHUB_REPONAME" \
-b "$changes" \
--replace $version \
postgrest-$version-linux-x64-static.tar.xz
if test $version = "nightly"
then
date=$(date +'%F')
sha=$(echo $CIRCLE_SHA1 | head -c7)
suffix=$date-$sha
tar cvJf postgrest-nightly-$suffix-linux-x64-static.tar.xz \
-C ${postgrest}/bin postgrest
${ghr}/bin/ghr \
-t "$GITHUB_TOKEN" \
-u "$GITHUB_USERNAME" \
-r "$GITHUB_REPONAME" \
--replace nightly \
postgrest-nightly-$suffix-linux-x64-static.tar.xz
else
changes="$(sed -n "1,/$version/d;/## \[/q;p" ${../../CHANGELOG.md})"
tar cvJf postgrest-$version-linux-x64-static.tar.xz \
-C ${postgrest}/bin postgrest
${ghr}/bin/ghr \
-t "$GITHUB_TOKEN" \
-u "$GITHUB_USERNAME" \
-r "$GITHUB_REPONAME" \
-b "$changes" \
--replace $version \
postgrest-$version-linux-x64-static.tar.xz
fi
'';

# Wrapper for login with docker. $DOCKER_USER/$DOCKER_PASS vars come from CircleCI.
Expand All @@ -54,11 +70,21 @@ let
docker load -i ${docker.image}
docker tag postgrest:latest "$DOCKER_REPO"/postgrest:latest
docker tag postgrest:latest "$DOCKER_REPO"/postgrest:$version
docker push "$DOCKER_REPO"/postgrest:latest
docker push "$DOCKER_REPO"/postgrest:$version
if test $version = "nightly"
then
date=$(date +'%F')
sha=$(echo $CIRCLE_SHA1 | head -c7)
suffix=$date-$sha
docker tag postgrest:latest "$DOCKER_REPO"/postgrest:nightly-$suffix
docker push "$DOCKER_REPO"/postgrest:nightly-$suffix
else
docker tag postgrest:latest "$DOCKER_REPO"/postgrest:latest
docker tag postgrest:latest "$DOCKER_REPO"/postgrest:$version
docker push "$DOCKER_REPO"/postgrest:latest
docker push "$DOCKER_REPO"/postgrest:$version
fi
'';

# Script for updating the repository description on Docker Hub.
Expand Down

0 comments on commit 356c0c7

Please sign in to comment.