Skip to content

A peer-to-peer stack for code collaboration

Proper releases. (#584)

Julian Arni17e3f4c54aab
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 7c60ade..49111ea 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -94,28 +94,22 @@ jobs:
- run:
name: Package
command: |
- version="$(date +%Y.%m.%d)-$(git rev-parse --short HEAD)"
- VERSION=$version TARGET=darwin ./packaging/build-package.sh
+ set -euxo pipefail
- # This is only set when building forked PRs
- if [ -n "$CIRCLE_PR_REPONAME" ]; then
- echo "Skipping uploads for forks"
- exit 0
- fi
+ if [ "$CIRCLE_BRANCH" == "master" && "$CIRCLE_TAG" == v*]; then
+ version="$TAG_NAME"
+ VERSION=$version TARGET=darwin ./packaging/build-package.sh
- echo "$GCLOUD_SERVICE_KEY" | \
- gcloud auth activate-service-account \
- --key-file=-
- if [ "$CIRCLE_BRANCH" == "master" ]; then
- # Upload package aliases for easier distribution
- cp \
- "packaging/out/radicle_${version}_x86_64-darwin.tar.gz" \
- "packaging/out/radicle_${date}_x86_64-darwin.tar.gz"
-
- cp \
- "packaging/out/radicle_${version}_x86_64-darwin.tar.gz" \
- "packaging/out/radicle_latest_x86_64-darwin.tar.gz"
- fi
+ # This is only set when building forked PRs
+ if [ -n "$CIRCLE_PR_REPONAME" ]; then
+ echo "Skipping uploads for forks"
+ exit 0
+ fi
- ./packaging/upload.sh
+ echo "$GCLOUD_SERVICE_KEY" | \
+ gcloud auth activate-service-account \
+ --key-file=-
+
+ ./packaging/upload.sh
+ fi
diff --git a/cloudbuild.yaml b/cloudbuild.yaml
index d0d1d5c..23e87a8 100644
--- a/cloudbuild.yaml
+++ b/cloudbuild.yaml
@@ -211,19 +211,9 @@ steps:
- |
set -euxo pipefail
- date=$(date +%Y.%m.%d)
- version="$date-$SHORT_SHA"
- VERSION=$version TARGET=debian ./packaging/build-package.sh
-
- if [ "$BRANCH_NAME" == "master" ]; then
- # Upload package aliases for easier distribution
- cp \
- "packaging/out/radicle_${version}_amd64.deb" \
- "packaging/out/radicle_${date}_amd64.deb"
-
- cp \
- "packaging/out/radicle_${version}_amd64.deb" \
- "packaging/out/radicle_latest_amd64.deb"
+ if [[ "$BRANCH_NAME" == "master" && "$TAG_NAME" == v* ]]; then
+ version="$TAG_NAME"
+ VERSION=$version TARGET=debian ./packaging/build-package.sh
+ ./packaging/upload.sh
fi
- ./packaging/upload.sh
diff --git a/scripts/make-release.sh b/scripts/make-release.sh
new file mode 100644
index 0000000..0422f69
--- /dev/null
+++ b/scripts/make-release.sh
@@ -0,0 +1,35 @@
+#!/bin/env bash
+
+VERSION=$1
+
+if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
+ echo "Bad version: $VERSION"
+ echo "Should have format 'x.y.z', where x, y and z are numbers"
+fi
+
+if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
+ echo "Not on branch 'master'. Aborting."
+ exit 1
+fi
+
+if [ "$(git rev-parse master)" != "$(git rev-parse origin/master)" ]; then
+ echo "master and origin/master differ. Aborting"
+ exit 1
+fi
+
+
+if [ "$(git status --untracked-files=no --porcelain)" != " M ChangeLog.md" ]; then
+ echo "No changes to ChangeLog.md, or other changes found in working directory."
+ echo "Make sure you've updated the changelog, and have no uncommited changes."
+ exit 1
+fi
+
+# Update package.yaml
+mv package.yaml old-package.yaml
+sed "s/^version: '.*'$/version: '$VERSION'" old-package.yaml > package.yaml
+rm old-package.yaml
+
+echo "git add package.yaml"
+echo "git add ChangeLog.md"
+echo "git commit -m \"Version update: $VERSION\""
+echo "git tag v$VERSION"