|
| 1 | +# Release Process |
| 2 | + |
| 3 | +## Versioning |
| 4 | +- Major stable public release versions require a major number increase |
| 5 | +- Breaking changes and major features require a minor number increase |
| 6 | +- Bugfixes require a patch number increase |
| 7 | + |
| 8 | +## Remotes |
| 9 | +> **NOTE:** Regarding git remotes: |
| 10 | +> * `upstream` points to core repository location |
| 11 | +> * `origin` points to the user's fork |
| 12 | +
|
| 13 | + |
| 14 | +## Prerequisites: |
| 15 | +- Prepare release notes |
| 16 | +- `cargo` credentials are cached |
| 17 | +- `git` credentials are available on host to allow pushing code |
| 18 | +- `gh` installed and configured |
| 19 | +- You are running the build process on a X86_64 host |
| 20 | +- Freeze all merges until release process complete |
| 21 | + |
| 22 | + |
| 23 | +## Weekly chores |
| 24 | +* [Update Rust toolchain](https://github.com/enarx/enarx/actions/workflows/rust-toolchain-update.yml) |
| 25 | +* [Update Cargo dependencies](https://github.com/enarx/enarx/actions/workflows/cargo-update.yml) |
| 26 | + |
| 27 | + |
| 28 | +### Update and release prerequiste crates |
| 29 | +> **NOTE:** The list of crates that need to be updated for a release can be seen by running this following command: |
| 30 | +> ```bash |
| 31 | +> grep -R 'git+https' *.lock | sort | uniq |
| 32 | +> ``` |
| 33 | +> This may be an optional step dependant on whether there are relevant changes in the prerequisite crates, including: |
| 34 | +> * [crt0stack](https://github.com/enarx/crt0stack) |
| 35 | +> * [flagset](https://github.com/enarx/flagset) |
| 36 | +> * [iocuddle](https://github.com/enarx/iocuddle) |
| 37 | +> * [lset](https://github.com/enarx/lset) |
| 38 | +> * [mmarinus](https://github.com/enarx/mmarinus) |
| 39 | +> * [mmledger](https://github.com/enarx/mmledger) |
| 40 | +> * [nbytes](https://github.com/enarx/nbytes) |
| 41 | +> * [noted](https://github.com/enarx/noted) |
| 42 | +> * [primordial](https://github.com/enarx/primordial) |
| 43 | +> * [rcrt1](https://github.com/enarx/rcrt1) |
| 44 | +> * [sallyport](https://github.com/enarx/sallyport) |
| 45 | +> * [sgx](https://github.com/enarx/sgx) |
| 46 | +> * [snp](https://github.com/enarx/snp) |
| 47 | +> * [vdso](https://github.com/enarx/vdso) |
| 48 | +> * [xsave](https://github.com/enarx/xsave) |
| 49 | +
|
| 50 | +#### Assumptions: |
| 51 | +- All approved PRs are merged |
| 52 | +- Rust toolchain (if using snapshot) and `cargo update` has been run |
| 53 | +
|
| 54 | +#### Steps: |
| 55 | +- Determine expected version by reviewing output of `git log` |
| 56 | +- Set new version |
| 57 | + ```bash |
| 58 | + export MAJOR=0 |
| 59 | + export MINOR=2 |
| 60 | + export PATCH=2 |
| 61 | + export NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}" |
| 62 | + ``` |
| 63 | +- Set REPO variable, assuming GitHub repository matches directory name |
| 64 | + ```bash |
| 65 | + export REPO="$(basename $PWD)" |
| 66 | + ``` |
| 67 | +- Get latest updates and checkout branch |
| 68 | + > **NOTE:** The following assumes a new release |
| 69 | + ```bash |
| 70 | + git fetch upstream |
| 71 | + git checkout -b "b${MAJOR}.${MINOR}.z" upstream/main |
| 72 | + ``` |
| 73 | +- Determine if crate builds and if it works |
| 74 | + ```bash |
| 75 | + cargo clean |
| 76 | + cargo build --release |
| 77 | + cargo test |
| 78 | + ``` |
| 79 | +- Update version in `Cargo.toml` |
| 80 | + ```bash |
| 81 | + sed -i 's/^version = .*/version = \"'${NEW_VERSION}'\"/' Cargo.toml |
| 82 | + cargo update -p $(grep name Cargo.toml | cut -d'"' -f2) |
| 83 | + ``` |
| 84 | +- Run `cargo test` again |
| 85 | + ```bash |
| 86 | + cargo clean |
| 87 | + cargo build --release |
| 88 | + cargo test |
| 89 | + ``` |
| 90 | +- Check if cargo successfully builds with dry run |
| 91 | + ```bash |
| 92 | + cargo publish --allow-dirty -v --dry-run |
| 93 | + ``` |
| 94 | +- Commit change and push to repo |
| 95 | + ```bash |
| 96 | + git commit -asS -m "chore(release): Release v${NEW_VERSION}" |
| 97 | + git push origin b${MAJOR}.${MINOR}.z |
| 98 | + ``` |
| 99 | +- Create a PR |
| 100 | + ```bash |
| 101 | + gh pr create -t "chore(release): Release v${NEW_VERSION}" \ |
| 102 | + -b "chore(release): Release v${NEW_VERSION}" \ |
| 103 | + -R enarx/${REPO} |
| 104 | + ``` |
| 105 | +- Confirm that changes passed on CI and merge PR |
| 106 | +- Checkout merged release branch |
| 107 | + ```bash |
| 108 | + git fetch upstream |
| 109 | + git checkout upstream/main |
| 110 | + ``` |
| 111 | +- Tag the new release on upstream |
| 112 | + ```bash |
| 113 | + git tag --sign -m "chore(release): Release v${NEW_VERSION}" v${NEW_VERSION} |
| 114 | + git push --tags upstream "b${MAJOR}.${MINOR}.z" |
| 115 | + ``` |
| 116 | +- Cargo publish |
| 117 | + > **NOTE:** Assuming cargo credentials are cached |
| 118 | + ```bash |
| 119 | + cargo publish -v |
| 120 | + ``` |
| 121 | + |
| 122 | +### The Enarx release itself |
| 123 | +- Determine expected version by reviewing output of `git log` |
| 124 | +- Set new version |
| 125 | + ```bash |
| 126 | + export MAJOR=0 |
| 127 | + export MINOR=2 |
| 128 | + export PATCH=2 |
| 129 | + export NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}" |
| 130 | + ``` |
| 131 | +- Get latest updates and checkout branch |
| 132 | + ```bash |
| 133 | + git fetch upstream |
| 134 | + git checkout -b "b${MAJOR}.${MINOR}.z" upstream/main |
| 135 | + ``` |
| 136 | +- Bump version inside sub-crate `src/bin/{shim-kvm,shim-sgx,exec-wasmtime}/Cargo.toml` files |
| 137 | + ```bash |
| 138 | + for d in src/bin/*/ ; do ( cd "$d" |
| 139 | + sed -i 's/^version = .*/version = \"'${NEW_VERSION}'\"/' Cargo.toml |
| 140 | + cargo update -p $(basename ${d}) |
| 141 | + done |
| 142 | + sed -i 's/^version = .*/version = \"'${NEW_VERSION}'\"/' Cargo.toml |
| 143 | + cargo update -p $(grep name Cargo.toml | cut -d'"' -f2) |
| 144 | + ``` |
| 145 | +- _POTENTIALLY OPTIONAL STEP: If there are any changes in the prerequisite crates (e.g. `xsave`, `sallyport`, etc) then it will be required to manually update the crates now_ |
| 146 | + ```bash |
| 147 | + export UPDATED_PREREQUISTES=(xsave sallyport) |
| 148 | + for d in src/bin/*/ ; do ( cd "$d" |
| 149 | + for p in ${UPDATED_PREREQUISTES[@]]}; do |
| 150 | + cargo update -p "${p}" |
| 151 | + done |
| 152 | + done |
| 153 | + for p in ${UPDATED_PREREQUISTES[@]]}; do cargo update -p ${p}; done |
| 154 | + ``` |
| 155 | +- Run unit tests |
| 156 | + ```bash |
| 157 | + cargo clean |
| 158 | + cargo build --release |
| 159 | + cargo test |
| 160 | + ``` |
| 161 | +- Check cargo manifest |
| 162 | + ```bash |
| 163 | + cargo package --allow-dirty -l |
| 164 | + ``` |
| 165 | +- Check if cargo successfully builds with dry run |
| 166 | + ```bash |
| 167 | + cd src/bin/shim-kvm; cargo publish --allow-dirty --dry-run -v --target x86_64-unknown-none; cd .. |
| 168 | + cd shim-sgx; cargo publish --allow-dirty --dry-run -v --target x86_64-unknown-none; cd .. |
| 169 | + cd exec-wasmtime; cargo publish --allow-dirty --dry-run -v ; cd ../.. |
| 170 | + ``` |
| 171 | +- Commit change and push to repo |
| 172 | + ```bash |
| 173 | + git commit -asS -m "chore(release): Release v${NEW_VERSION}" |
| 174 | + git push origin "release/${NEW_VERSION}" |
| 175 | + ``` |
| 176 | +- Packaging binary dependency crates |
| 177 | + > **NOTE:** Assuming cargo credentials are cached |
| 178 | + ```bash |
| 179 | + cd src/bin/shim-kvm; cargo publish -v --target x86_64-unknown-none; cd .. |
| 180 | + cd shim-sgx; cargo publish -v --target x86_64-unknown-none; cd .. |
| 181 | + cd exec-wasmtime; cargo publish -v ; cd ../.. |
| 182 | + ``` |
| 183 | +- Update enarx dependencies |
| 184 | + ```bash |
| 185 | + export UPDATED_BINDEPS=(enarx-exec-wasmtime enarx-shim-kvm enarx-shim-sgx) |
| 186 | + for p in ${UPDATED_PREREQUISTES[@]]}; do |
| 187 | + cargo update -p "${p}" |
| 188 | + done |
| 189 | + ``` |
| 190 | +- Run unit tests |
| 191 | + ```bash |
| 192 | + cargo clean |
| 193 | + cargo build --release |
| 194 | + cargo test |
| 195 | + ``` |
| 196 | +- Cargo dry-run publish |
| 197 | + ```bash |
| 198 | + cargo publish --allow-dirty --dry-run -v |
| 199 | + ``` |
| 200 | +- Commit change and push to repo |
| 201 | + ```bash |
| 202 | + git commit -asS --amend |
| 203 | + git push --force origin "release/${NEW_VERSION}" |
| 204 | + ``` |
| 205 | +- Create a PR |
| 206 | + ```bash |
| 207 | + gh pr create -t "chore(release): Release v${NEW_VERSION}" \ |
| 208 | + -b "chore(release): Release v${NEW_VERSION}" \ |
| 209 | + -R enarx/${REPO} |
| 210 | + ``` |
| 211 | +- Confirm that changes passed on CI and merge PR |
| 212 | +- Checkout merged release branch |
| 213 | + ```bash |
| 214 | + git fetch upstream |
| 215 | + git checkout upstream/main |
| 216 | + ``` |
| 217 | +- Tag the new release on upstream |
| 218 | + ```bash |
| 219 | + git tag --sign -m "chore(release): Release v${NEW_VERSION}" v${NEW_VERSION} |
| 220 | + git push --tags upstream "b${MAJOR}.${MINOR}.z" |
| 221 | + ``` |
| 222 | +- Create a release PR |
| 223 | + ```bash |
| 224 | + gh pr create -t "Release v${NEW_VERSION}" \ |
| 225 | + -b "" |
| 226 | + -B main \ |
| 227 | + -R enarx/enarx |
| 228 | + ``` |
| 229 | +- Merge release PR |
| 230 | +- Cargo publish |
| 231 | + ```bash |
| 232 | + cargo publish -v |
| 233 | + ``` |
| 234 | +- Create draft GitHub release |
| 235 | + ```bash |
| 236 | + gh release create -d --generate-notes "v${NEW_VERSION}" |
| 237 | + ``` |
| 238 | +- Update release notes on draft GitHub release |
| 239 | +- Publish GitHub release |
| 240 | +- Send notification to RocketChat #annoucements & #general channels |
| 241 | +- Assign issue to post release to social media channels |
0 commit comments