-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (133 loc) · 4.96 KB
/
bump-and-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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Bump and release
run-name: ${{ (inputs.version == '' && 'Not bumping version') || format('Bumping version to {0}', inputs.version) }} and ${{ (inputs.dryRun == true && 'validating') || 'releasing' }} ${{ inputs.connectors }}
on:
workflow_dispatch:
inputs:
version:
description: 'Version to bump and tag. If unset, then skips version bump and tag.'
required: false
type: string
dryRun:
description: 'Dry run to only validate without release.'
required: true
default: true
type: boolean
connectors:
description: 'Choose the Connector(s)'
required: true
type: choice
default: 'All'
options:
- All
- Utilities
- Comscore
- Conviva
- SideloadedSubtitle
jobs:
Bump-And-Release:
runs-on: macos-14
outputs:
previousVersion: ${{ steps.store_previous_version.outputs.previousVersion }}
steps:
- name: Log stacks
run: |
echo "Log macOS version"
sw_vers
echo "Log Xcode version"
xcodebuild -version
- name: Check out repository code
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
- id: store_previous_version
name: Store previous version value
run: |
previousVersion=$(ruby -r "./THEOplayer-Connector-Version.rb" -e "print_theoplayer_connector_version")
echo "previousVersion=$previousVersion" >> "$GITHUB_OUTPUT"
- name: Update the version.json file
if: inputs.version != ''
run: sh update_version_json.sh -v ${{ inputs.version }}
- name: Commit and push the changes made to the version.json file
if: inputs.version != ''
run: |
git add version.json
git commit -m "update version.json"
git push
- name: Update CHANGELOG.md file
if: inputs.version != '' && inputs.dryRun == false
run: sh update_changelog.sh -v ${{ inputs.version }}
- name: Commit and push the changes made to the CHANGELOG.md file
if: inputs.version != '' && inputs.dryRun == false
run: sh commit_changelog.sh
- name: Add and push new git tag
if: inputs.version != ''
run: |
git tag ${{ inputs.version }}
git push origin ${{ inputs.version }}
- name: ${{ (inputs.dryRun == true && 'Validate') || 'Release' }} on Cocoapods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
# make the command
command="${{ (inputs.dryRun == true && 'spec lint') || 'trunk push' }}"
# make the list of connectors
prefix="THEOplayer-Connector"
connectors=()
if [ "${{ inputs.connectors }}" == "All" ]; then
files=(*)
for file in ${files[*]}
do
if [[ $file == *.podspec ]]; then
# we add the Utilities later at index 0
if [[ $file == *Utilities.podspec ]]; then
continue
fi
# blacklisted podspecs
if [[ $file == *VerizonMedia.podspec || $file == *Nielsen.podspec || $file == *Yospace.podspec ]]; then
continue
fi
# Conviva validation depends on Utilities being available, which does not get published in a dry run
# => skip Conviva if dry run
if [[ $file == *Conviva.podspec && ${{ inputs.dryRun }} == true ]]; then
continue
fi
connectors+=("$file")
fi
done
connectors=("$prefix-Utilities.podspec" "${connectors[@]}")
else
connectors+=("$prefix-${{ inputs.connectors }}.podspec")
fi
for connector in ${connectors[*]}
do
pod repo update
pod $command $connector --verbose --allow-warnings --synchronous
done
Cleanup:
needs: Bump-And-Release
if: (inputs.dryRun == true && inputs.version != '') && (success() || failure())
runs-on: macos-14
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
- name: Update to latest
run: |
git fetch --all
git pull
- name: Remove and unpublish git tag
run: git push --delete origin refs/tags/${{ inputs.version }}
- name: Update(Revert) the version.json file back to the previous version
env:
PREVIOUS_VERSION: ${{ needs.Bump-And-Release.outputs.previousVersion }}
run: |
sh update_version_json.sh -v $PREVIOUS_VERSION
- name: Commit and push the changes made to the version.json file
run: |
diff=$(git diff version.json)
if [[ $diff != '' ]]; then
git add version.json
git commit -m "update version.json"
git push
fi