blob: 2f638ec22a379b23cc520afc18785ffb841f20a2 [file] [log] [blame]
Serge Bazanski417d7f62023-11-20 12:57:20 +01001syntax = "proto3";
2package version.spec;
3option go_package = "source.monogon.dev/version/spec";
4
5// Version of an artifact released from the Monogon monorepo.
6//
7// A few assumptions are made here:
8// 1. The version can be serialized to a SemVer 2.0.0 version string, which can
9// then be deserialized back to this proto.
10// 2. Not every SemVer 2.0.0 version string can be deserialized back into a
11// Version, notably only a subset of prerelease labels are supported, and no
12// build metadata is supported.
13// 3. A Version is valid for a given 'product' built by the monorepo build
14// system - there's no single Version for the entire repository.
15message Version {
16 // Last release for this artifact. If unset, 0.0.0 is assumed. SemVer
17 // major/minor/patch semantics are observed.
18 message Release {
19 int64 major = 1;
20 int64 minor = 2;
21 int64 patch = 3;
Serge Bazanski417d7f62023-11-20 12:57:20 +010022 }
23 Release release = 1;
24
25 // Information gathered from Git at time of build.
26 message GitInformation {
27 // Hex-encoded commit short hash of the monorepo checked out during
28 // build.
29 //
30 // This will be used to populate the -gXXXXXX prerelease field in the
31 // serialized SemVer format.
32 string commit_hash = 1;
33 // Number of commits since the given Release.
34 //
35 // If non-zero, this will be used to populate the -devY prerelease field
36 // in the serialized SemVer format.
37 uint64 commits_since_release = 2;
38
39 // State of the Git checkout during the build.
40 //
41 // If dirty, this will set the -dirty prerelease field in the serialized
42 // SemVer format.
43 enum BuildTreeState {
44 BUILD_TREE_STATE_INVALID = 0;
45 BUILD_TREE_STATE_CLEAN = 1;
46 BUILD_TREE_STATE_DIRTY = 2;
47 };
48 BuildTreeState build_tree_state = 3;
49 }
50 GitInformation git_information = 2;
51}