forked from braintree/braintree-ios-drop-in
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (77 loc) · 3.65 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true
jobs:
release:
name: Release
runs-on: macOS-13
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Xcode 15.1
run: sudo xcode-select -switch /Applications/Xcode_15.1.app
- name: Check for unreleased section in changelog
run: grep "## unreleased" CHANGELOG.md || (echo "::error::No unreleased section found in CHANGELOG"; exit 1)
- name: Set git username and email
run: |
git config user.name braintreeps
git config user.email [email protected]
- name: Update version, add tag and push
run: |
today=$(date +'%Y-%m-%d')
sed -i '' 's/## unreleased.*/## '"${{ github.event.inputs.version }}"' ('"$today"')/' CHANGELOG.md
sed -i '' 's/\(s\.version *= *\).*/\1"'"${{ github.event.inputs.version }}"'\"/' BraintreeDropIn.podspec
plutil -replace CFBundleVersion -string ${{ github.event.inputs.version }} -- 'Demo/Application/Supporting Files/Braintree-Demo-Info.plist'
plutil -replace CFBundleShortVersionString -string ${{ github.event.inputs.version }} -- 'Demo/Application/Supporting Files/Braintree-Demo-Info.plist'
plutil -replace CFBundleVersion -string ${{ github.event.inputs.version }} -- 'Sources/BraintreeDropIn/Info.plist'
plutil -replace CFBundleShortVersionString -string ${{ github.event.inputs.version }} -- 'Sources/BraintreeDropIn/Info.plist'
git add .
git commit -m 'Bump version to ${{ github.event.inputs.version }}'
git tag ${{ github.event.inputs.version }} -a -m 'Release ${{ github.event.inputs.version }}'
git push origin HEAD ${{ github.event.inputs.version }}
- name: Save changelog entries to a file
run: |
sed -e '1,/##/d' -e '/##/,$d' CHANGELOG.md > changelog_entries.md
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
release_name: ${{ github.event.inputs.version }}
body_path: changelog_entries.md
draft: false
prerelease: false
- name: Publish to CocoaPods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: pod trunk push BraintreeDropIn.podspec
- name: Publish reference docs
run: |
gem install jazzy
brew install sourcekitten
sourcekitten doc --objc Docs/BraintreeDropIn-Umbrella-Header.h -- \
-x objective-c -isysroot $(xcrun --show-sdk-path --sdk iphonesimulator) \
-I $(pwd)/Sources/BraintreeDropIn/Public \
> objcDoc.json
jazzy \
--sourcekitten-sourcefile objcDoc.json \
--author Braintree \
--author_url http://braintreepayments.com \
--github_url https://github.com/braintree/braintree-ios-drop-in \
--github-file-prefix https://github.com/braintree/braintree-ios-drop-in/tree/${{ github.event.inputs.version }} \
--theme fullwidth \
--output ${{ github.event.inputs.version }}
cp -R Images ${{ github.event.inputs.version }}/Images
git checkout gh-pages
ln -sfn ${{ github.event.inputs.version }} current
git add current ${{ github.event.inputs.version }}
git commit -m "Publish ${{ github.event.inputs.version }} docs to github pages"
git push