diff --git a/scripts/release/01-promote_changelog b/scripts/release/01-promote_changelog new file mode 100755 index 0000000000..91d630d6f2 --- /dev/null +++ b/scripts/release/01-promote_changelog @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -eou pipefail + +if [[ "$#" -ne 1 ]]; then + echo "$0: RELEASE" + exit 1 +fi + +SCRIPT_DIR=`dirname "$0"` +OSO_DIR="${SCRIPT_DIR}/../.." +RELEASE=$1 + +pushd $OSO_DIR +pushd docs/content/any/project/changelogs + +cp NEXT.md "${RELEASE}".md +cp TEMPLATE.md NEXT.md diff --git a/scripts/release/02-bump-versions b/scripts/release/02-bump-versions new file mode 100755 index 0000000000..c2dae69606 --- /dev/null +++ b/scripts/release/02-bump-versions @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -eou pipefail + +if [[ "$#" -ne 1 ]]; then + echo "$0: VERSION" + exit 1 +fi + +SCRIPTDIR=`dirname "$0"` +VERSION="$1" +pushd $SCRIPTDIR + +python ./bump_versions.py --oso_version "${VERSION}" \ + --sqlalchemy_version "${VERSION}" \ + --flask_version "${VERSION}" \ + --django_version "${VERSION}" diff --git a/scripts/release/03-push-tags b/scripts/release/03-push-tags new file mode 100755 index 0000000000..674e09bded --- /dev/null +++ b/scripts/release/03-push-tags @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -eou pipefail + +if [[ "$#" -ne 1 ]]; then + echo "$0: VERSION" + exit 1 +fi + +if [[ `git branch --show-current` != "main" ]]; then + echo "Must create tags from main." + echo "Switch to main and pull to ensure the release commit is included." + exit 1 +fi + +SCRIPTDIR=`dirname "$0"` +VERSION="$1" +pushd $SCRIPTDIR + +OSO_TAG="v${VERSION}" +DJANGO_TAG="django-v${VERSION}" +FLASK_TAG="flask-v${VERSION}" +SQLALCHEMY_TAG="sqlalchemy-v${VERSION}" + +git tag -a "${OSO_TAG}" -m "${OSO_TAG}" +git tag -a "${DJANGO_TAG}" -m "${DJANGO_TAG}" +git tag -a "${FLASK_TAG}" -m "${FLASK_TAG}" +git tag -a "${SQLALCHEMY_TAG}" -m "${SQLALCHEMY_TAG}" + +git push origin ${OSO_TAG} +git push origin ${DJANGO_TAG} +git push origin ${FLASK_TAG} +git push origin ${SQLALCHEMY_TAG} diff --git a/scripts/release/04-publish-release b/scripts/release/04-publish-release new file mode 100755 index 0000000000..2e63c28a9e --- /dev/null +++ b/scripts/release/04-publish-release @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -eou pipefail + +if [[ "$#" -ne 1 ]]; then + echo "$0: VERSION" + exit 1 +fi + +VERSION=$1 + +function check_status () { + out=$(mktemp /tmp/osorelease.XXXXX) + RES=$(gh api -X GET repos/{owner}/{repo}/actions/runs -f "q='branch:v${VERSION}'" | \ + jq ".workflow_runs[] | {name, id, conclusion, head_branch} | select((.name | contains(\"Release\")) and (.head_branch | contains(\"${VERSION}\")))" | tee "$out" | jq '.conclusion == "success"') + + echo "Status" + cat "${out}" + rm "${out}" + + echo -n "${RES}" | jq -es 'all' +} + +echo "Waiting for release jobs to succeed..." + +until check_status +do + echo "Waiting..." + sleep 5 +done + +echo "Jobs done" + +echo "Running oso release workflow" + +gh workflow run publish.yml -f version=${VERSION} + +echo 'Watching main release job' +sleep 10 +WORKFLOW_ID=$(gh api -X GET repos/{owner}/{repo}/actions/workflows/publish.yml/runs -f q='branch:v0.25.1' | jq '.workflow_runs | first | .id') + +gh run watch "${WORKFLOW_ID}" + +echo 'Checking main release result' +gh api -X GET repos/{owner}/{repo}/actions/workflows/publish.yml/runs -f q='branch:v0.25.1' | jq -e '.workflow_runs | first | .conclusion == "success"' + +echo 'Running package releases...' +gh workflow run publish-django-release.yml -f version=${VERSION} +gh workflow run publish-sqlalchemy-release.yml -f version=${VERSION} +gh workflow run publish-flask-release.yml -f version=${VERSION} + +echo 'Check status of releases before publishing documentation.' diff --git a/scripts/release/05-publish-docs b/scripts/release/05-publish-docs new file mode 100755 index 0000000000..a2ab77865b --- /dev/null +++ b/scripts/release/05-publish-docs @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -eou pipefail + +echo 'Publishing docs...' +gh workflow run publish-docs.yml -f url=docs.oso.dev diff --git a/scripts/bump_versions.py b/scripts/release/bump_versions.py similarity index 100% rename from scripts/bump_versions.py rename to scripts/release/bump_versions.py