Skip to content

Commit 03891a3

Browse files
committed
docs
1 parent 0b508c3 commit 03891a3

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

xtask/src/ci/release.rs

+62
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,65 @@
1+
// TODO: More details/ensure accuracy
2+
//!
3+
//! # The `publish` job + `build`
4+
//!
5+
//! The `publish` job is triggered in five cases.
6+
//! All of these need the event to be a push (since the `build` job is a need for `publish`,
7+
//! and that need is gated on `if: github.event_name == 'push'`
8+
//!
9+
//! 1. on the default_branch, or `main` in our case
10+
//! 2. on the `staging` branch
11+
//! 3. on the `try` branch
12+
//! 4. on branches matching `v*.*.*`
13+
//! 5. on tags matching `v*.*.*`
14+
//!
15+
//! ## In `default_branch`/`main`
16+
//!
17+
//! In the case of `main`, the workflow does the following.
18+
//!
19+
//! 1. `build` builds and publishes images for these targets with the tag `main` and `edge`. It also assembles binaries for artifacting
20+
//! 2. If all ok, the `publish` job triggers
21+
//! 3. this calls `cargo xtask ci-job release` which
22+
//! 1. inspects the package version
23+
//! 2. if the version does not exist as a tag, create a new tag for that version and push it.
24+
//! this tag will trigger the `CI` workflow again, but with `ref_type == "tag"`
25+
//! if the version does exist, exit quietly.
26+
//! 4. `publish` now calls `cargo-publish` which creates a new release with draft tag `Unreleased`, attaches binaries from step 1, and does a `cargo publish --dry-run`, this tag uses the standard github token for workflows, and should not be able to trigger any other workflows.
27+
//!
28+
//! ## In `staging` / `try` branch
29+
//!
30+
//! In `staging` or `try`, we need to make sure that nothing goes out.
31+
//! This includes tags, releases and `cargo publish`
32+
//!
33+
//! 1. `build` builds (but does not publish) images for these targets with the tag `try`/`staging`. It also assembles binaries for artifacting
34+
//! 2. If all ok, the `publish` job triggers
35+
//! 4. this calls `cargo xtask ci-job release` which
36+
//! 1. inspects the package version
37+
//! 2. if the version does not exist as a tag, "dry-run" creating the tag and push it.
38+
//! if the version does exist, exit quietly.
39+
//! 5. `publish` now calls `cargo-publish` which does a `cargo publish --dry-run`
40+
//!
41+
//! ## On branches matching `v*.*.*`
42+
//!
43+
//! 1. `build` builds (but does not publish) images for these targets with the tag `vx.y.z` and `edge`. It also assembles binaries for artifacting
44+
//! 2. If all ok, the `publish` job triggers
45+
//! 3. this calls `cargo xtask ci-job release` which
46+
//! 1. inspects the package version
47+
//! 2. since the `ref_type == "branch"`, if the version does not exist as a tag,
48+
//! create a new tag for that version and push it.
49+
//! this tag will trigger the `CI` workflow again, but with `ref_type == "tag"`
50+
//! if the version does exist, exit quietly.
51+
//! 4. `publish` now calls `cargo-publish` which does nothing
52+
//!
53+
//! ## On tags matching `v*.*.*`
54+
//!
55+
//! In this case, we need to make sure that the created release does not trigger a workflow.
56+
//!
57+
//! 1. `build` builds and publishes images for these targets with the tag `vx.y.z`. It also assembles binaries for artifacting
58+
//! 2. If all ok, the `publish` job triggers
59+
//! 4. this calls `cargo xtask ci-job release` which
60+
//! 1. inspects the package version
61+
//! 2. since the `ref_type == "tag"`, the program exits quietly.
62+
//! 5. `publish` now calls `cargo-publish` which creates a new release with tag `vx.y.z`, attaches binaries from step 1, and does a `cargo publish`, this release tag uses the standard github token for workflows, and should not be able to trigger any other workflows.
163
use clap::Args;
264
use cross::{shell::MessageInfo, CommandExt};
365

0 commit comments

Comments
 (0)