Skip to content

Commit 16d119b

Browse files
committed
Add Project for version and build numbers
1 parent 02b2301 commit 16d119b

File tree

5 files changed

+90
-81
lines changed

5 files changed

+90
-81
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ struct Script {
8686
- [x] Test: test project
8787
- [x] Archive: archive project
8888
- [x] ExportArchive: export archive
89-
- [x] SetBuildNumber: set build number
90-
- [x] SetVersion: set version
91-
- [x] IncreaseBuildNumber: increase build number
9289
- [x] AppStore Connect: use https://github.com/onmyway133/AppStoreConnect
9390
- [x] GetBuildSettings: get project build settings
9491
- [ ] GenerateIcon: generate app icon set
@@ -107,6 +104,12 @@ struct Script {
107104
- [x] Fetch TestFlight builds
108105
- [x] Fetch latest TestFlight build number
109106

107+
#### Project
108+
109+
- [x] Set version
110+
- [x] Set build number
111+
- [x] Increment build number
112+
110113
#### Keychain
111114

112115
- [x] Create custom keychain

Sources/Swiftlane/Actions/iOS/IncreaseBuildNumber.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
//
2+
// Project.swift
3+
// Swiftlane
4+
//
5+
// Created by Khoa on 18/02/2022.
6+
//
7+
8+
import Foundation
9+
10+
public struct Project {
11+
public var workflow: Workflow?
12+
13+
public init() {}
14+
15+
public func set(
16+
version: String
17+
) async throws {
18+
Settings.cs.action("Set version \(version)")
19+
20+
var args = Args()
21+
args.flag("new-marketing-version")
22+
args.flag(version)
23+
24+
25+
try Settings.cli.run(
26+
program: "agvtool",
27+
argument: args.toString(),
28+
currentDirectoryURL: workflow?.directory
29+
)
30+
}
31+
32+
public func set(
33+
buildNumber: String
34+
) async throws {
35+
Settings.cs.action("Set build number \(buildNumber)")
36+
37+
var args = Args()
38+
args.flag("new-version")
39+
args.flag(buildNumber)
40+
args.flag("-all")
41+
42+
try Settings.cli.run(
43+
program: "agvtool",
44+
argument: args.toString(),
45+
currentDirectoryURL: workflow?.directory
46+
)
47+
}
48+
49+
public func incrementBuildNumber() async throws {
50+
Settings.cs.action("Increment build number")
51+
52+
var args = Args()
53+
args.flag("next-version")
54+
args.flag("-all")
55+
56+
try Settings.cli.run(
57+
program: "agvtool",
58+
argument: args.toString(),
59+
currentDirectoryURL: workflow?.directory
60+
)
61+
}
62+
63+
public func currentVersion() async throws -> String {
64+
var args = Args()
65+
args.flag("what-marketing-version")
66+
67+
return try Settings.cli.run(
68+
program: "agvtool",
69+
argument: args.toString(),
70+
currentDirectoryURL: workflow?.directory
71+
)
72+
}
73+
74+
public func currentBuildNumber() async throws -> String {
75+
var args = Args()
76+
args.flag("what-version")
77+
78+
return try Settings.cli.run(
79+
program: "agvtool",
80+
argument: args.toString(),
81+
currentDirectoryURL: workflow?.directory
82+
)
83+
}
84+
}

Sources/Swiftlane/Actions/iOS/SetBuildNumber.swift

Lines changed: 0 additions & 27 deletions
This file was deleted.

Sources/Swiftlane/Actions/iOS/SetVersion.swift

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)