Skip to content

Commit a4a6e9e

Browse files
committed
Add notes about releasing.
Pull in the script from gtm-session-fetcher to help update the podspec.
1 parent dfd34ea commit a4a6e9e

File tree

2 files changed

+100
-1
lines changed

2 files changed

+100
-1
lines changed

DEVELOPMENT.md

+52-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ file for how to contribute to this project.
1717
## CocoaPods
1818

1919
Install
20-
* CocoaPods 1.10.0 (or later)
20+
* CocoaPods 1.12.0 (or later)
2121
* [CocoaPods generate](https://github.com/square/cocoapods-generate) - This is
2222
not part of the _core_ cocoapods install.
2323

@@ -29,3 +29,54 @@ pod gen GoogleAPIClientForREST.podspec --local-sources=./ --auto-open --platform
2929

3030
Note: Set the `--platforms` option to `macos`, `tvos`, or `watchos` to
3131
develop/test for those platforms.
32+
33+
---
34+
35+
## Releasing
36+
37+
To update the version number and push a release:
38+
39+
1. Examine what has changed; determine the appropriate new version number.
40+
41+
1. Update the version number.
42+
43+
Run the `update_version.py` script to update the appropriate files with the
44+
new version number, by passing in the new version (must be in X.Y.Z format).
45+
46+
```sh
47+
$ ./update_version.py 3.2.1
48+
```
49+
50+
Submit the changes to the repo.
51+
52+
1. Create a release on Github.
53+
54+
Top left of the [project's release page](https://github.com/google/google-api-objectivec-client-for-rest/releases)
55+
is _Draft a new release_.
56+
57+
The tag should be vX.Y.Z where the version number X.Y.Z _exactly_ matches
58+
the one you provided to the `update_version.py` script. (GoogleAPIClientForREST
59+
has a `v` prefix on its tags.)
60+
61+
For the description call out any major changes in the release. Usually the
62+
_Generate release notes_ button in the toolbar is a good starting point and
63+
just updating as need for more/less detail (dropping comments about CI,
64+
updating the version number, etc.).
65+
66+
1. Publish the CocoaPod.
67+
68+
NOTE: You must be a registered owner of the podspec and be "logged in" from
69+
the CocoaPods pov locally to do this. The general google account for pods is
70+
and owner and can be used for releases.
71+
72+
```sh
73+
$ pod trunk push --skip-import-validation --skip-tests GoogleAPIClientForREST.podspec
74+
```
75+
76+
NOTE: Since validations are run on CI during every PR/commit, they are skipped here
77+
because publish takes a long time. And M2 based MBP can take > 1 hour to do this
78+
because of all of the subspecs and because the pod supports all of Apple platforms.
79+
80+
The tests are skipped because Cocoapods has had issues with running watchOS tests
81+
based on the local machines config. Those are also covered in github CI, so this
82+
should be good.

update_version.py

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#! /usr/bin/python3
2+
# update_version.py.py - Helper for the library's version number
3+
#
4+
# Copyright 2017 Google Inc. All rights reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
import os
19+
import re
20+
import sys
21+
22+
_PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
23+
_PODSPEC_PATH = os.path.join(_PROJECT_ROOT, 'GoogleAPIClientForREST.podspec')
24+
25+
26+
def main(args):
27+
if len(args) != 1:
28+
sys.stderr.write('update_version.py VERSION\n')
29+
sys.exit(1)
30+
31+
ver_str = args[0]
32+
if len(ver_str.split('.')) != 3:
33+
sys.stderr.write('Version should always be three segments.\n')
34+
sys.exit(1)
35+
36+
# podspec
37+
pod_content = open(_PODSPEC_PATH).read()
38+
pod_content = re.sub(r'version = \'\d+\.\d+\.\d+\'',
39+
'version = \'%s\'' % (ver_str,),
40+
pod_content)
41+
assert ver_str in pod_content
42+
open(_PODSPEC_PATH, 'w').write(pod_content)
43+
44+
return 0
45+
46+
47+
if __name__ == '__main__':
48+
sys.exit(main(sys.argv[1:]))

0 commit comments

Comments
 (0)