6
6
set -eu -o pipefail
7
7
shopt -s lastpipe
8
8
9
- function check_snapshot_version {
10
- local version=$1
11
- local snap_version=$( echo $version | cut -f-2 -d. | tr . _)
12
- if ! grep -s FC_V${snap_version} _SNAP_VERSION src/vmm/src/version_map.rs; then
13
- die " I couldn't find FC_V${snap_version} _SNAP_VERSION in src/vmm/src/version_map.rs"
14
- fi
15
- }
16
-
17
9
FC_TOOLS_DIR=$( dirname $( realpath $0 ) )
18
10
source " $FC_TOOLS_DIR /functions"
19
11
FC_ROOT_DIR=$FC_TOOLS_DIR /..
@@ -26,18 +18,16 @@ $0 <version>
26
18
27
19
Prepare a new Firecracker release:
28
20
1. Update the version number
29
- 2. Update Crate dependencies
30
- 3. Generate CREDITS.md and CHANGELOG.md
31
- 4. Commit the result
32
- 5. Create a link to PR the changes
21
+ 2. Generate CREDITS.md and CHANGELOG.md
22
+ 3. Commit the result
23
+ 4. Create a link to PR the changes
33
24
EOF
34
25
exit 1
35
26
fi
36
27
version=$1
37
28
validate_version " $version "
38
29
39
30
check_local_branch_is_release_branch
40
- check_snapshot_version " $version "
41
31
42
32
# Create GitHub PR link
43
33
ORIGIN_URL=$( git config --get remote.origin.url)
@@ -55,49 +45,19 @@ if [ "$PATCH" -gt 0 ]; then
55
45
fi
56
46
PR_URL=" https://github.com/firecracker-microvm/$REPO /compare/$TARGET_BRANCH ...$GH_USER :$REPO :$LOCAL_BRANCH ?expand=1"
57
47
58
- # Get current version from the swagger spec.
59
- prev_ver=$( get_swagger_version)
60
-
61
- say " Updating from $prev_ver to $version ..."
62
- # Update version in files.
63
- files_to_change=(
64
- " $FC_ROOT_DIR /src/api_server/swagger/firecracker.yaml"
65
- " $FC_ROOT_DIR /src/cpu-template-helper/Cargo.toml"
66
- " $FC_ROOT_DIR /src/firecracker/Cargo.toml"
67
- " $FC_ROOT_DIR /src/jailer/Cargo.toml"
68
- " $FC_ROOT_DIR /src/rebase-snap/Cargo.toml"
69
- " $FC_ROOT_DIR /src/seccompiler/Cargo.toml"
70
- )
71
- say " Updating source files:"
72
- for file in " ${files_to_change[@]} " ; do
73
- say " - $file "
74
- # Dirty hack to make this work on both macOS/BSD and Linux.
75
- # FIXME This is very hacky and can unintentionally bump other versions, so
76
- # only do the replacement *once*.
77
- sed -i " s/$prev_ver /$version /" " $file "
78
- done
79
-
80
- CHANGED=()
81
- # Run `cargo check` to update firecracker and jailer versions in all
82
- # `Cargo.lock`.
83
- # NOTE: This will break if it finds paths with spaces in them
84
- find . -path ./build -prune -o -name Cargo.lock -print | while read -r cargo_lock; do
85
- say " Updating $cargo_lock ..."
86
- (cd " $( dirname " $cargo_lock " ) " ; cargo check)
87
- CHANGED+=(" $cargo_lock " )
88
- done
48
+ # Update version
49
+ $FC_TOOLS_DIR /bump-version.sh " $version "
89
50
90
51
# Update credits.
91
52
say " Updating credits..."
92
53
$FC_TOOLS_DIR /update-credits.sh
93
- CHANGED+=(CREDITS.md)
94
54
95
55
# Update changelog.
96
56
say " Updating changelog..."
97
57
sed -i " s/\[Unreleased\]/\[$version \]/g" " $FC_ROOT_DIR /CHANGELOG.md"
98
- CHANGED+=(CHANGELOG.md)
99
58
100
- git add " ${files_to_change[@]} " " ${CHANGED[@]} "
59
+ # Add all changed files
60
+ git add -u
101
61
git commit -s -m " chore: release v$version "
102
62
103
63
@@ -123,7 +83,7 @@ $(pp-li 1. Check the changes made to the repo:)
123
83
124
84
$( pp-li 2. Preview the release notes)
125
85
126
- $( pp-code ./tools/release-notes.sh " $prev_ver " " $ version" )
86
+ $( pp-code ./tools/release-notes.sh " $version " )
127
87
128
88
$( pp-li 3. If you want to undo the changes, run)
129
89
@@ -135,5 +95,5 @@ $(pp-li 4. Review and merge this change)
135
95
$PR_URL
136
96
137
97
$( pp-li 5. Once it is reviewed and merged, run the tag script)
138
- $( pp-code ./tools/release-tag.sh $prev_ver $ version)
98
+ $( pp-code ./tools/release-tag.sh $version )
139
99
EOF
0 commit comments