Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaRU authored Oct 12, 2024
1 parent 5dcf004 commit 135c14b
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
![swift-version](https://img.shields.io/badge/swift-5.6-brightgreen.svg?style=for-the-badge)
![Mac OS](https://img.shields.io/badge/-platform-gray?style=for-the-badge)![Mac OS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=Apple&logoColor=F0F0F0)![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)
[![License](https://img.shields.io/github/license/yonaskolb/Mint.svg?style=for-the-badge)](LICENSE)
[![License](https://img.shields.io/github/license/DimaRU/PackageBuildInfo.svg?style=for-the-badge)](LICENSE)

# PackageBuildInfo

#### Automated Swift Package version and build numbering via Git. Swift Package Manager plugin.
#### Automated Swift Package version and build numbering via Git. A Swift Package Manager plugin.

Wouldn't it be great if your Swift Package-based projects just take their version and build number automatically from git? Well, now it can!

Expand Down Expand Up @@ -47,27 +47,27 @@ Sample project here:
import Foundation

public struct PackageBuild {
let isDirty: Bool // Dirty build - git directory is't clean.
let timeStamp: Date // Time of last commit
let timeZone: TimeZone // Time Zone
let count: Int // Total commit count
let tag: String? // Tag, if exist
let countSinceTag: Int // Commit count since tag
let branch: String? // Git branch name
let digest: [UInt8] // Latest commit sha1 digest (20 bytes)

var commit: String {
public let isDirty: Bool // Dirty build - git directory is't clean.
public let timeStamp: Date // Time of last commit
public let timeZone: TimeZone // Time Zone
public let count: Int // Total commit count
public let tag: String? // Tag, if exist
public let countSinceTag: Int // Commit count since tag
public let branch: String? // Git branch name
public let digest: [UInt8] // Latest commit sha1 digest (20 bytes)

public var commit: String {
digest.reduce("") { $0 + String(format: "%02x", $1) }
}
static let info = PackageBuild(
public static let info = PackageBuild(
isDirty: false,
timeStamp: Date(timeIntervalSince1970: 1651955365),
timeStamp: Date(timeIntervalSince1970: 1728751843),
timeZone: TimeZone(secondsFromGMT: 10800) ?? TimeZone.current,
count: 6,
count: 10,
tag: "1.0.0",
countSinceTag: 2,
countSinceTag: 6,
branch: "master",
digest: [0x72, 0x75, 0x92, 0xa4, 0x2d, 0xa7, 0x16, 0xb5, 0x9d, 0x2b, 0x0f, 0x06, 0x1d, 0xbc, 0x61, 0x4d, 0xc9, 0xa7, 0x58, 0x92])
digest: [0xa3, 0xf9, 0xa7, 0x1a, 0xab, 0x55, 0x20, 0x91, 0xc3, 0x7f, 0x32, 0x60, 0x11, 0x70, 0xa9, 0x97, 0xd9, 0xf5, 0x21, 0x91])
}
```

Expand Down

0 comments on commit 135c14b

Please sign in to comment.