|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +set -euo pipefail |
| 4 | + |
| 5 | +usage() { |
| 6 | + cat <<'EOF' |
| 7 | +Usage: |
| 8 | + ./release.sh --version VERSION --team-id TEAM_ID |
| 9 | + ./release.sh VERSION TEAM_ID |
| 10 | +
|
| 11 | +Runs the release build steps starting at `make clean`. |
| 12 | +EOF |
| 13 | +} |
| 14 | + |
| 15 | +VERSION="" |
| 16 | +TEAMID="" |
| 17 | + |
| 18 | +while [[ $# -gt 0 ]]; do |
| 19 | + case "$1" in |
| 20 | + -v|--version) |
| 21 | + VERSION="${2:-}" |
| 22 | + shift 2 |
| 23 | + ;; |
| 24 | + -t|--team-id) |
| 25 | + TEAMID="${2:-}" |
| 26 | + shift 2 |
| 27 | + ;; |
| 28 | + -h|--help) |
| 29 | + usage |
| 30 | + exit 0 |
| 31 | + ;; |
| 32 | + -*) |
| 33 | + echo "Unknown option: $1" >&2 |
| 34 | + usage >&2 |
| 35 | + exit 1 |
| 36 | + ;; |
| 37 | + *) |
| 38 | + if [[ -z "$VERSION" ]]; then |
| 39 | + VERSION="$1" |
| 40 | + elif [[ -z "$TEAMID" ]]; then |
| 41 | + TEAMID="$1" |
| 42 | + else |
| 43 | + echo "Unexpected argument: $1" >&2 |
| 44 | + usage >&2 |
| 45 | + exit 1 |
| 46 | + fi |
| 47 | + shift |
| 48 | + ;; |
| 49 | + esac |
| 50 | +done |
| 51 | + |
| 52 | +if [[ -z "$VERSION" || -z "$TEAMID" ]]; then |
| 53 | + usage >&2 |
| 54 | + exit 1 |
| 55 | +fi |
| 56 | + |
| 57 | +echo "Cleaning build artifacts" |
| 58 | +make clean |
| 59 | + |
| 60 | +echo "Creating signed zip" |
| 61 | +make zip |
| 62 | + |
| 63 | +echo "Creating Homebrew bottle for $VERSION" |
| 64 | +make bottle VERSION="$VERSION" |
| 65 | + |
| 66 | +echo "Duplicating bottle for expected platform filenames" |
| 67 | +cp "xcodes-$VERSION.mojave.bottle.tar.gz" "xcodes-$VERSION.arm64_mojave.bottle.tar.gz" |
| 68 | +cp "xcodes-$VERSION.mojave.bottle.tar.gz" "xcodes-$VERSION.macos.i386.bottle.tar.gz" |
| 69 | +cp "xcodes-$VERSION.mojave.bottle.tar.gz" "xcodes-$VERSION.macos.arm64.bottle.tar.gz" |
| 70 | + |
| 71 | +echo "Notarizing release build with team ID $TEAMID" |
| 72 | +make notarize TEAMID="$TEAMID" |
| 73 | + |
| 74 | +cat <<EOF |
| 75 | +
|
| 76 | +Release assets are ready: |
| 77 | + xcodes.zip |
| 78 | + xcodes-$VERSION.mojave.bottle.tar.gz |
| 79 | + xcodes-$VERSION.arm64_mojave.bottle.tar.gz |
| 80 | + xcodes-$VERSION.macos.i386.bottle.tar.gz |
| 81 | + xcodes-$VERSION.macos.arm64.bottle.tar.gz |
| 82 | +
|
| 83 | +Next: |
| 84 | + 1. Push the version bump commit and tag when ready: |
| 85 | + git push --follow-tags |
| 86 | + 2. Edit the draft release created by Release Drafter to point at the new tag. |
| 87 | + 3. Set the release title to $VERSION. |
| 88 | + 4. Add the release assets listed above. |
| 89 | + 5. Publish the release. |
| 90 | + 6. Update the Homebrew bottle. |
| 91 | +EOF |
0 commit comments