|
71 | 71 | echo "✅ All commits since the last release are merge commits." |
72 | 72 | fi |
73 | 73 |
|
74 | | -# Get the next release version |
| 74 | +# Get the next version to release |
75 | 75 | VERSION=$(echo "$LAST_RELEASE_TAG" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sed 's/^v//' || true) |
76 | 76 | if [ -z "$VERSION" ]; then |
77 | 77 | echo "❌ Unable to determine the next release version from the last release tag: $LAST_RELEASE_TAG" |
78 | 78 | exit 1 |
79 | 79 | fi |
80 | 80 | if [ "$MINOR_RELEASE" = true ]; then |
81 | | - NEXT_RELEASE_VERSION=$(echo "$VERSION" | awk -F. '{printf "v%d.%d.0", $1, $2 + 1}') |
| 81 | + NEXT_VERSION=$(echo "$VERSION" | awk -F. '{printf "%d.%d.0", $1, $2 + 1}') |
82 | 82 | else |
83 | | - NEXT_RELEASE_VERSION=$(echo "$VERSION" | awk -F. '{printf "v%d.%d.%d", $1, $2, $3 + 1}') |
| 83 | + NEXT_VERSION=$(echo "$VERSION" | awk -F. '{printf "%d.%d.%d", $1, $2, $3 + 1}') |
84 | 84 | fi |
85 | | -echo "ℹ️ Next release version: $NEXT_RELEASE_VERSION" |
| 85 | +echo "ℹ️ Next version to release: $NEXT_VERSION" |
| 86 | + |
| 87 | +# Check milestone exists |
| 88 | +if ! gh api "repos/{owner}/{repo}/milestones" --paginate --jq ".[].title" | grep -qx "$NEXT_VERSION"; then |
| 89 | + echo "❌ Milestone '$NEXT_VERSION' does not exist. Please reach out to the guild before performing a release." |
| 90 | + exit 1 |
| 91 | +fi |
| 92 | +echo "✅ GitHub milestone for $NEXT_VERSION exists." |
86 | 93 |
|
87 | 94 | # Create and push the release tag |
88 | | -echo "ℹ️ The release tag will be created and pushed. No abort is possible after this point." |
| 95 | +NEXT_RELEASE_TAG="v$NEXT_VERSION" |
| 96 | +echo "ℹ️ The release tag $NEXT_RELEASE_TAG will be created and pushed. No abort is possible after this point." |
89 | 97 | confirmOrAbort |
90 | | -git tag -a -s -m "Release $NEXT_RELEASE_VERSION" "$NEXT_RELEASE_VERSION" |
91 | | -git push "$REMOTE" "$NEXT_RELEASE_VERSION" --no-verify |
92 | | -echo "✅ Release tag $NEXT_RELEASE_VERSION created and pushed to $REMOTE." |
| 98 | +git tag -a -s -m "Release $NEXT_RELEASE_TAG" "$NEXT_RELEASE_TAG" |
| 99 | +if ! git push "$REMOTE" "$NEXT_RELEASE_TAG" --no-verify; then |
| 100 | + echo "❌ Unable to push the release tag to $REMOTE." |
| 101 | + echo "ℹ️ Deleting the created local tag." |
| 102 | + git tag -d "$NEXT_RELEASE_TAG" |
| 103 | + exit 1 |
| 104 | +fi |
| 105 | +echo "✅ Release tag $NEXT_RELEASE_TAG created and pushed to $REMOTE." |
0 commit comments