Skip to content

Commit ef3ba12

Browse files
authored
Automatically pick the calver when making a release. (#2)
1 parent cdd4301 commit ef3ba12

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Tools/Release/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
products: [.executable(name: "release", targets: ["Release"])],
1010
dependencies: [
1111
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.3.0"),
12-
.package(url: "https://github.com/element-hq/swift-command-line-tools.git", revision: "e5eaab1558ef664e6cd80493f64259381670fb3a")
12+
.package(url: "https://github.com/element-hq/swift-command-line-tools.git", revision: "c085ad85c27970e4bba2dd1180c2a53ab77022ba")
1313
// .package(path: "../../../swift-command-line-tools")
1414
],
1515
targets: [

Tools/Release/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Creates a Github release from a matrix-rust-sdk repository.
55

66
Usage:
77
```
8-
swift run release --version v1.0.18-alpha
8+
swift run release # e.g. version 25.12.31
99
```
1010

11-
For help: `swift run release --help`
11+
For help (including how to customise the version): `swift run release --help`
1212

1313
## Requirements
1414

Tools/Release/Sources/Release.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ import Foundation
44

55
@main
66
struct Release: AsyncParsableCommand {
7-
@Option(help: "The version of the package that is being released.")
8-
var version: String
7+
@Option(help: "An optional build number that will be appended to the generated version (e.g. 25.12.31-123). This option is ignored when a custom version is specified.")
8+
var buildNumber: Int? = nil
9+
10+
@Option(help: "A custom version to use instead of generating a calendar version. This option takes precedence over --build-number.")
11+
var customVersion: String? = nil
12+
13+
var version: String {
14+
customVersion ?? Date.now.calendarVersion(buildNumber: buildNumber)
15+
}
916

1017
@Flag(help: "Prevents the run from pushing anything to GitHub.")
1118
var localOnly = false

0 commit comments

Comments
 (0)