Skip to content

Commit 57a9da4

Browse files
authored
SWIFT-134 Write a release script (#277)
1 parent 78db81a commit 57a9da4

File tree

10 files changed

+96
-39
lines changed

10 files changed

+96
-39
lines changed

.jazzy.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module: MongoSwift
2+
root_url: https://mongodb.github.io/mongo-swift-driver
3+
github_url: https://github.com/mongodb/mongo-swift-driver
4+
documentation: Guides/*.md
5+
author: Matt Broadstone, Kaitlin Mahar, and Patrick Freed

.sourcery.yml

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

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
os: osx
1616
install: ./Tests/Scripts/install_dependencies.sh sourcery
1717
before_script: skip
18-
script: ${PWD}/sourcery/bin/sourcery; git diff --exit-code Tests/LinuxMain.swift
18+
script: export sourcery=${PWD}/sourcery/bin/sourcery; make linuxmain; git diff --exit-code Tests/LinuxMain.swift
1919

2020
- stage: tests
2121
os: osx

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ else
55
FILTERARG =
66
endif
77

8+
ifdef DOCSVERSION
9+
DOCSARG = --module-version $(DOCSVERSION)
10+
else
11+
DOCSARG =
12+
endif
13+
814
define check_for_gem
915
gem list $(1) -i > /dev/null || gem install $(1) || { echo "ERROR: Failed to locate or install the ruby gem $(1); please install yourself with 'gem install $(1)' (you may need to use sudo)"; exit 1; }
1016
endef
@@ -19,9 +25,9 @@ project:
1925
@$(call check_for_gem,xcodeproj)
2026
ruby Tests/Scripts/add_json_files.rb
2127

22-
sourcery:
23-
sourcery
24-
28+
linuxmain:
29+
sourcery --sources Tests/ --templates Tests/LinuxMain.stencil --output Tests/LinuxMain.swift
30+
2531
test:
2632
swift test -v $(FILTERARG)
2733

@@ -46,4 +52,4 @@ clean:
4652
documentation:
4753
make project
4854
@$(call check_for_gem,jazzy)
49-
jazzy --module MongoSwift --module-version 0.1.0 --root-url https://mongodb.github.io/mongo-swift-driver/ --documentation=Guides/*.md
55+
jazzy $(DOCSARG)

MongoSwift.podspec

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

Sources/MongoSwift/MongoSwift.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import mongoc
22

33
private final class MongocInitializer {
4-
private static let versionString = "0.1.0"
54
internal static let shared = MongocInitializer()
65

76
private init() {
87
mongoc_init()
9-
mongoc_handshake_data_append("MongoSwift", MongocInitializer.versionString, nil)
8+
mongoc_handshake_data_append("MongoSwift", MongoSwiftVersionString, nil)
109
}
1110
}
1211

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// swiftlint:disable:previous vertical_whitespace
2+
internal let MongoSwiftVersionString = "{{ argument.versionString }}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Generated using Sourcery 0.15.0 — https://github.com/krzysztofzablocki/Sourcery
2+
// DO NOT EDIT
3+
4+
5+
// swiftlint:disable:previous vertical_whitespace
6+
internal let MongoSwiftVersionString = "0.1.0"

release/RELEASE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
MongoSwift release process
2+
============================
3+
4+
1. Ensure all the JIRA tickets for this release are resolved. You can find the releases on [this page](https://jira.mongodb.org/projects/SWIFT?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page&status=unreleased).
5+
1. From the base directory of the project, run `release/release.sh` with the new version, e.g. `./release/release.sh 1.0.0`.
6+
1. The release script should have taken you to the GitHub page for the tag.
7+
- Click "Edit Tag".
8+
- Add a title, "MongoSwift [version here]".
9+
- Add a description. See [previous release notes](https://github.com/mongodb/mongo-swift-driver/releases/tag/v0.1.0) for an example of what this looks like. You can use the JIRA "Release Notes" HTML as a starting point.
10+
- Click "Publish release".
11+
1. Mark the release as published on JIRA.
12+
1. Send a message to the #swift Slack channel.

release/release.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# usage: ./release/release.sh [new version string]
2+
# for example: ./release/release.sh 1.0.0
3+
4+
# update version string for libmongoc handshake
5+
sourcery --sources Sources/MongoSwift --templates Sources/MongoSwift/MongoSwiftVersion.stencil --output Sources/MongoSwift/MongoSwiftVersion.swift --args versionString=${1}
6+
7+
# regenerate documentation with new version string
8+
export DOCSVERSION=${1}
9+
make documentation
10+
11+
# commit changes
12+
git add docs/
13+
git add Sources/MongoSwift/MongoSwiftVersion.swift
14+
git commit -m "${1}"
15+
16+
# tag release
17+
git tag "v${1}"
18+
19+
# push changes
20+
git push --tags
21+
22+
# update podspec
23+
cat > ${PWD}/MongoSwift.podspec <<- EOF
24+
Pod::Spec.new do |spec|
25+
spec.name = "MongoSwift"
26+
spec.version = "${1}"
27+
spec.summary = "The Swift driver for MongoDB"
28+
spec.homepage = "https://github.com/mongodb/mongo-swift-driver"
29+
spec.license = 'Apache License, Version 2.0'
30+
spec.authors = {
31+
"Matt Broadstone" => "[email protected]",
32+
"Kaitlin Mahar" => "[email protected]",
33+
"Patrick Freed" => "[email protected]"
34+
}
35+
36+
spec.source = {
37+
:git => "https://github.com/mongodb/mongo-swift-driver.git",
38+
:tag => 'v${1}'
39+
}
40+
41+
spec.ios.deployment_target = "11.0"
42+
spec.tvos.deployment_target = "10.2"
43+
spec.watchos.deployment_target = "4.3"
44+
45+
spec.requires_arc = true
46+
spec.source_files = "Sources/MongoSwift/**/*.swift"
47+
48+
spec.dependency 'mongo-embedded-c-driver', '~> 1.13.0-4.0.0'
49+
end
50+
EOF
51+
52+
# publish new podspec
53+
pod trunk push ${PWD}/MongoSwift.podspec
54+
55+
# cleanup podspec
56+
rm ${PWD}/MongoSwift.podspec
57+
58+
# go to GitHub to publish release notes
59+
open "https://github.com/mongodb/mongo-swift-driver/releases/tag/v${1}"

0 commit comments

Comments
 (0)