|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +set -e |
| 4 | + |
| 5 | +DOCKER_IMAGE=swiftnav/libsbp-build:2023-12-19 |
| 6 | +RUN_DOCKER="docker run -it --rm -v $PWD:/mnt/workspace -t ${DOCKER_IMAGE}" |
| 7 | +VERSION=$(./scripts/get_release_version.py $(git describe --match 'v*' --always --tags)) |
| 8 | + |
| 9 | +if [ $# -ne 0 ]; then |
| 10 | + VERSION=$1 |
| 11 | + shift |
| 12 | +fi |
| 13 | + |
| 14 | +if [ -z "${CHANGELOG_GITHUB_TOKEN}" ]; then |
| 15 | + echo "You must set CHANGELOG_GITHUB_TOKEN in your environment before running this command" |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | + |
| 19 | +git diff --exit-code >/dev/null 2>&1 |
| 20 | +if [ $? -ne 0 ]; then |
| 21 | + echo "Working directory is not clean. Remove any and all changes before running this command" |
| 22 | + exit 1 |
| 23 | +fi |
| 24 | + |
| 25 | +echo "Releasing libsbp version ${VERSION}" |
| 26 | + |
| 27 | +echo "Creating initial commit and tag" |
| 28 | +git commit --allow-empty -m "Release ${VERSION}" |
| 29 | +git tag -a ${VERSION} -m "Version ${VERSION} of libsbp." |
| 30 | + |
| 31 | +echo "Building python" |
| 32 | +${RUN_DOCKER} make gen-python |
| 33 | + |
| 34 | +echo "Updating tag" |
| 35 | +git add . |
| 36 | +git commit --amend -a -m "Release ${VERSION}" |
| 37 | +git tag -f -a ${VERSION} -m "Version ${VERSION} of libsbp." |
| 38 | + |
| 39 | +echo "Building language bindings" |
| 40 | +${RUN_DOCKER} make gen-java gen-javascript gen-protobuf |
| 41 | +${RUN_DOCKER} make gen-c gen-haskell gen-javascript gen-rust |
| 42 | + |
| 43 | +echo "Updating tag" |
| 44 | +git add . |
| 45 | +git commit --amend -a -m "Release ${VERSION}" |
| 46 | +git tag -f -a ${VERSION} -m "Version ${VERSION} of libsbp." |
| 47 | + |
| 48 | +echo "Rebuilding javascript" |
| 49 | +${RUN_DOCKER} make gen-javascript |
| 50 | +${RUN_DOCKER} make gen-javascript |
| 51 | + |
| 52 | +echo "Updating tag" |
| 53 | +git add . |
| 54 | +git commit --amend -a -m "Release ${VERSION}" |
| 55 | +git tag -f -a ${VERSION} -m "Version ${VERSION} of libsbp." |
| 56 | + |
| 57 | +echo "Buliding kaitai" |
| 58 | +${RUN_DOCKER} make gen-kaitai |
| 59 | + |
| 60 | +echo "Updating tag" |
| 61 | +git add . |
| 62 | +git commit --amend -a -m "Release ${VERSION}" |
| 63 | +git tag -f -a ${VERSION} -m "Version ${VERSION} of libsbp." |
| 64 | + |
| 65 | +echo "Building documentation" |
| 66 | +${RUN_DOCKER} make docs |
| 67 | + |
| 68 | +echo "Updating tag" |
| 69 | +git add . |
| 70 | +git commit --amend -a -m "Release ${VERSION}" |
| 71 | +git tag -f -a ${VERSION} -m "Version ${VERSION} of libsbp." |
| 72 | + |
| 73 | +echo "Generating changelog" |
| 74 | +make release |
| 75 | +./scripts/merge_changelogs.py ${VERSION} |
| 76 | +rm -f DRAFT_CHANGELOG.md |
| 77 | + |
| 78 | +echo "Updating tag" |
| 79 | +git add . |
| 80 | +git commit --amend -a -m "Release ${VERSION}" |
| 81 | +git tag -f -a ${VERSION} -m "Version ${VERSION} of libsbp." |
| 82 | + |
| 83 | +git diff HEAD~1 |
| 84 | + |
| 85 | +cat <<EOF |
| 86 | +A new commit and tag has been created. Look at the above diff and verify the contents. If everything looks good you can push to master straight away. |
| 87 | +
|
| 88 | +If there are any mistakes now is the time to correct them. Make any changes which are required then update the tag by running: |
| 89 | +
|
| 90 | +git add <files> |
| 91 | +git commit --amend -a -m "Release ${VERSION}" |
| 92 | +git tag -f -a ${VERSION} -m "Version ${VERSION} of libsbp." |
| 93 | +
|
| 94 | +Once you have fixed everything you can push to master |
| 95 | +
|
| 96 | +Once pushed prepare for the next release by running ./scripts/prep_for_next_release.sh |
| 97 | +EOF |
0 commit comments