Skip to content

Commit

Permalink
Creating automation to help create releases. (#523)
Browse files Browse the repository at this point in the history
* Adding releage tagging script to help with releases.

Signed-off-by: Scott Nichols <snichols@vmware.com>

* adding tagging and pushing

Signed-off-by: Scott Nichols <snichols@vmware.com>
  • Loading branch information
Scott Nichols authored May 27, 2020
1 parent 046759a commit 4ca23c8
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/draft-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- 'protocol*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Draft Releases

jobs:

release-tags:
name: draft-release

steps:

- name: Create Draft Release
id: create_draft_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
61 changes: 61 additions & 0 deletions hack/tag-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

VERSION=v2.0.0

# It is intended that this file is run locally. For a full release tag, confirm the version is correct, and then:
# ./hack/tag-release.sh --tag --push

CREATE_TAGS=0 # default is a dry run
PUSH_TAGS=0 # Assumes `upstream` is the remote name for sdk-go.

# Loop through arguments and process them
for arg in "$@"
do
case $arg in
-t|--tag)
CREATE_TAGS=1
shift
;;
-p|--push)
PUSH_TAGS=1
shift
;;
esac
done

echo --- All Modules ---
for gomodule in $(find . | grep "go\.mod" | awk '{gsub(/\/go.mod/,""); print $0}' | grep -v "./v2/test")
do
echo " $gomodule"
done

echo --- Tagging ---

MODULES=(
"" # root module
"protocol/amqp"
"protocol/stan"
"protocol/nats"
"protocol/pubsub"
"protocol/kafka_sarama"
)

for i in "${MODULES[@]}"; do
tag=""
if [ "$i" = "" ]; then
tag="$VERSION"
else
tag="$i/$VERSION"
fi
echo " $tag"
if [ "$CREATE_TAGS" -eq "1" ]; then
git tag $TAG
fi
if [ "$PUSH_TAGS" -eq "1" ]; then
git push upstream $TAG
fi
done
6 changes: 3 additions & 3 deletions hack/unit-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ set -o pipefail
COVERAGE="`pwd`/coverage.txt"
echo 'mode: atomic' > $COVERAGE

for amod in $(find . | grep "go\.mod" | awk '{gsub(/\/go.mod/,""); print $0}' | grep -v "./test" | grep -v "./conformance")
for gomodule in $(find . | grep "go\.mod" | awk '{gsub(/\/go.mod/,""); print $0}' | grep -v "./test" | grep -v "./conformance")
do
echo --- Testing $amod ---
pushd $amod
echo --- Testing $gomodule ---
pushd $gomodule
touch ./coverage.tmp
COVERPKG=$(go list ./... | grep -v /vendor | grep -v /test | tr "\n" ",")

Expand Down

0 comments on commit 4ca23c8

Please sign in to comment.