circleci: add nightly release

For github and dockerhub
This commit is contained in:
steve-chavez
2020-11-10 22:47:58 -05:00
committed by Steve Chavez
parent 51b43f5605
commit 5d140f6fa0
2 changed files with 55 additions and 19 deletions
+15 -5
View File
@@ -224,19 +224,27 @@ workflows:
# Make sure that this job also runs when releases are tagged. # Make sure that this job also runs when releases are tagged.
filters: filters:
tags: tags:
only: /v[0-9]+(\.[0-9]+)*/ only:
- /v[0-9]+(\.[0-9]+)*/
- nightly
- stack-test: - stack-test:
filters: filters:
tags: tags:
only: /v[0-9]+(\.[0-9]+)*/ only:
- /v[0-9]+(\.[0-9]+)*/
- nightly
- stack-test-memory: - stack-test-memory:
filters: filters:
tags: tags:
only: /v[0-9]+(\.[0-9]+)*/ only:
- /v[0-9]+(\.[0-9]+)*/
- nightly
- nix-build-test: - nix-build-test:
filters: filters:
tags: tags:
only: /v[0-9]+(\.[0-9]+)*/ only:
- /v[0-9]+(\.[0-9]+)*/
- nightly
- release: - release:
requires: requires:
- style-check - style-check
@@ -245,6 +253,8 @@ workflows:
- nix-build-test - nix-build-test
filters: filters:
tags: tags:
only: /v[0-9]+(\.[0-9]+)*/ only:
- /v[0-9]+(\.[0-9]+)*/
- nightly
branches: branches:
ignore: /.*/ ignore: /.*/
+26
View File
@@ -20,6 +20,21 @@ let
version=$1 version=$1
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})" changes="$(sed -n "1,/$version/d;/## \[/q;p" ${../../CHANGELOG.md})"
tar cvJf postgrest-$version-linux-x64-static.tar.xz \ tar cvJf postgrest-$version-linux-x64-static.tar.xz \
@@ -32,6 +47,7 @@ let
-b "$changes" \ -b "$changes" \
--replace $version \ --replace $version \
postgrest-$version-linux-x64-static.tar.xz postgrest-$version-linux-x64-static.tar.xz
fi
''; '';
# Wrapper for login with docker. $DOCKER_USER/$DOCKER_PASS vars come from CircleCI. # Wrapper for login with docker. $DOCKER_USER/$DOCKER_PASS vars come from CircleCI.
@@ -54,11 +70,21 @@ let
docker load -i ${docker.image} docker load -i ${docker.image}
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:latest
docker tag postgrest:latest "$DOCKER_REPO"/postgrest:$version docker tag postgrest:latest "$DOCKER_REPO"/postgrest:$version
docker push "$DOCKER_REPO"/postgrest:latest docker push "$DOCKER_REPO"/postgrest:latest
docker push "$DOCKER_REPO"/postgrest:$version docker push "$DOCKER_REPO"/postgrest:$version
fi
''; '';
# Script for updating the repository description on Docker Hub. # Script for updating the repository description on Docker Hub.