Skip to content

Commit a586af9

Browse files
committed
Update release documentation and scripts to record flushed-out steps
1 parent 09be880 commit a586af9

File tree

2 files changed

+65
-10
lines changed

2 files changed

+65
-10
lines changed

admin/RELEASING.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
# How-to release `rustls-platform-verifier`
22

33
This document records the steps to publish new versions of the crate since it requires non-trivial preparation and ordering
4-
that needs to be remembered due to the Android component's distribution.
4+
that needs to be accounted for due to the Android component's distribution.
5+
6+
The Rustls repo also has [RELEASING] guidance for more information (e.g. on best practices for creating a GitHub release with a changelog)
7+
and other steps.
8+
9+
In the release preparation PR, the releaser may include the following checklist in the description so post-merge actions can be tracked:
10+
```markdown
11+
### Post-merge steps
12+
13+
- [ ] Generate Android Maven artifacts locally
14+
- [ ] Create and push Git tag
15+
- [ ] `cargo publish` for each required crate, based on release steps
16+
- [ ] Create companion GitHub release
17+
```
518

619
## Steps
720

@@ -14,21 +27,24 @@ that needs to be remembered due to the Android component's distribution.
1427
* We typically leave these branches around for future maintenance releases.
1528
4. Run `ci/package_android_release.sh` in a UNIX compatible shell
1629
5. (Optional) `cargo publish -p rustls-platform-verifier-android --dry-run --alow-dirty`
17-
<!---
18-
TODO: Consider instead making tag-specific commits that check-in the artifacts. For now, the
19-
seamless AAR reproducibility makes this a non-issue.
20-
-->
21-
* `--allow-dirty` is required because we don't check-in the generated Maven local repository at this time.
30+
* `--allow-dirty` is required because we don't check-in the generated Maven local repository.
2231
6. (Optional) Inspect extracted archive to ensure the local Maven repository artifacts are present
2332
1. Un-tar the `rustls-platform-verifier-android-*.crate` file inside of `target/package`.
2433
2. Verify `maven/rustls/rustls-platform-verifier` contains a single `*.RELEASE` directory and that contains a `.aar` file.
2534
3. (Optional) If the releaser has an external Gradle project that uses the configuration from the README, paste the path to the
2635
unzipped package's `Cargo.toml` as a replacement for the `manifestPath` variable. Run a Gradle Sync and observe everything works.
27-
7. Publish the Android artifacts' new version: `cargo publish -p rustls-platform-verifier-android --alow-dirty`
36+
7. **Ensure that all version changes are committed to the correct branch before proceeding**. All version increases should be checked in prior
37+
to publishing on crates.io.
38+
8. Publish the Android artifacts' new version: `cargo publish -p rustls-platform-verifier-android --alow-dirty`
39+
2840
3. Commit main crate's version increase on the release branch
29-
4. Publish the main crate's new version: `cargo publish -p rustls-platform-verifier`
41+
4. **Ensure that all version changes are committed to the correct branch before proceeding**. All version increases should be checked in prior
42+
to publishing on crates.io.
43+
5. Publish the main crate's new version: `cargo publish -p rustls-platform-verifier`
3044
* Do **not** use `--allow-dirty` for the main crate. Only the Android component requires it and a dirty workspace elsewhere is an error.
31-
32-
See the Rustls repo [RELEASING] guidance for more information (e.g. on best practices for creating a GitHub release with a changelog).
45+
6. Follow the remaining steps in [RELEASING] to create the appropiate version tag.
46+
7. If a new Android component release was made: Before publishing the GitHub release, run `./ci/archive_android_release.sh` to create a reproducible archive
47+
containing the Android Maven components that were just published to crates.io. After creating the archive, upload it as an additional release artifact on GitHub.
48+
Then, finish the release creation like normal.
3349

3450
[RELEASING]: https://github.com/rustls/rustls/blob/main/RELEASING.md

ci/archive_android_release.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
# This script's purpose is to package up the Android-specific artifacts from a previous run of `cargo publish -p rustls-platform-verifier-android` for
4+
# later attachment to GitHub releases. It is also intended to be fully reproducible.
5+
6+
set -euo pipefail
7+
8+
TAR_NAME="tar"
9+
OUTPUT_NAME="android-artifacts.tar"
10+
version=$(grep -m 1 "version = " android-release-support/Cargo.toml | tr -d "version= " | tr -d '"')
11+
source_date_epoch=$(git log -1 --pretty=%ct)
12+
13+
# bsdtar (which is the default on macOS) doesn't support the flags we want, so attempt to find a version of GNU
14+
# tar on the system is possible.
15+
if $TAR_NAME --version | grep -q "bsdtar"; then
16+
echo "Detected bsdtar, which is not compatible with this script. Attempting 'gnutar'"
17+
TAR_NAME="gnutar"
18+
19+
if $TAR_NAME --version | grep -q "bsdtar"; then
20+
echo "GNU tar not found, exiting"
21+
exit 1
22+
fi
23+
fi
24+
25+
artifacts_dir="target/package/rustls-platform-verifier-android-$version"
26+
27+
# This differs based on host target, etc.
28+
rm -rf "$artifacts_dir/target"
29+
# This shows up a lot on macOS, so make sure it doesn't get in the way.
30+
rm -f "$artifacts_dir/.DS_Store"
31+
32+
# Ref: https://reproducible-builds.org/docs/archives/
33+
$TAR_NAME --sort=name \
34+
--mtime="@${source_date_epoch}" \
35+
--owner=0 --group=0 --numeric-owner \
36+
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
37+
-cf "$artifacts_dir/../$OUTPUT_NAME" -C "$artifacts_dir" .
38+
39+
echo "Successfully created tarball at $artifacts_dir/$OUTPUT_NAME"

0 commit comments

Comments
 (0)