Skip to content

Commit

Permalink
release: Add examples to the release (#1074)
Browse files Browse the repository at this point in the history
It also retries uploading the files since looks like the release is
still not created even the create command has finish.

Signed-off-by: Enrique Llorente <[email protected]>
  • Loading branch information
qinqon authored Apr 29, 2022
1 parent 4cb02d7 commit ec40b0e
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,27 @@ gh_organization=nmstate
gh_repo=kubernetes-nmstate
github_release_cmd="go run github.com/github-release/github-release"

MANIFESTS_DIR=${MANIFESTS_DIR:-build/_output/manifests}

function eventually() {
retries=2
interval=2
n=0
until [ "$n" -ge $retries ]
do
$@ && break
n=$((n+1))
sleep $interval
done
[ "$n" -lt $retries ]
}

function upload() {
resource=$1
$github_release_cmd upload \
eventually $github_release_cmd upload \
-u $gh_organization \
-r $gh_repo \
-R \
--name $(basename $resource) \
--tag $new_version \
--file $resource
Expand All @@ -27,7 +43,10 @@ function create_github_release() {
--tag $new_version \
--name $new_version \
--description "$(hack/render-release-notes.sh $old_version $new_version)"
}


function upload_github_release_artifacts() {

# Upload operator CRDs
for manifest in $(ls deploy/crds/nmstate.io_*nmstate*); do
Expand All @@ -41,6 +60,10 @@ function create_github_release() {
for manifest in $(find $MANIFESTS_DIR -type f); do
upload $manifest
done

# Upload examples
tar -cvzf /tmp/examples.tar.gz $(find docs/examples -type f)
upload /tmp/examples.tar.gz
}

make OPERATOR_IMAGE_TAG=$new_version HANDLER_IMAGE_TAG=$new_version \
Expand All @@ -49,3 +72,4 @@ make OPERATOR_IMAGE_TAG=$new_version HANDLER_IMAGE_TAG=$new_version \
push-operator

create_github_release
upload_github_release_artifacts

0 comments on commit ec40b0e

Please sign in to comment.