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