Skip to content

Commit ada47fa

Browse files
committed
update versions in spec files
1 parent 4a49cbc commit ada47fa

2 files changed

Lines changed: 210 additions & 85 deletions

File tree

.github/workflows/ios-release.yml

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
tags:
66
- '*'
7-
release:
8-
types: [published]
97

108
jobs:
119
release:
@@ -79,22 +77,37 @@ jobs:
7977
git add *.podspec
8078
git commit -m "Update version to $VERSION"
8179
82-
# Determine target branch and push
83-
if [ "${{ github.event_name }}" = "release" ]; then
84-
BRANCH="${{ github.event.release.target_commitish }}"
85-
else
86-
# Tag push - find the branch
87-
BRANCH=$(git branch -r --contains ${{ github.sha }} | grep -v HEAD | head -1 | sed 's/.*origin\///' | xargs)
88-
fi
80+
# Find the branch that contains this tag
81+
BRANCH=$(git branch -r --contains ${{ github.sha }} | grep -v HEAD | head -1 | sed 's/.*origin\///' | xargs)
8982
9083
if [ ! -z "$BRANCH" ]; then
9184
echo "Pushing version updates to branch: $BRANCH"
85+
86+
# Fetch latest changes from remote
87+
git fetch origin $BRANCH
88+
89+
# Rebase our commit on top of the latest remote changes
90+
git rebase origin/$BRANCH
91+
92+
# Push the rebased commit
9293
git push origin HEAD:$BRANCH
9394
else
9495
echo "Warning: Could not determine branch, skipping push"
9596
fi
9697
fi
9798
99+
# Check if tag is on master branch
100+
- name: Check if tag is on master
101+
id: check_master
102+
run: |
103+
if git branch -r --contains ${{ github.sha }} | grep -q 'origin/master'; then
104+
echo "is_master=true" >> $GITHUB_OUTPUT
105+
echo "Tag is on master branch"
106+
else
107+
echo "is_master=false" >> $GITHUB_OUTPUT
108+
echo "Tag is NOT on master branch"
109+
fi
110+
98111
# Step 2: Validate Podspecs
99112
- name: Validate NewRelicVideoAgent podspec
100113
run: |
@@ -115,9 +128,9 @@ jobs:
115128
run: echo "All podspecs validated successfully!"
116129

117130
# Step 3: Publish to CocoaPods (In Order)
118-
# Only run publishing steps on master branch or releases targeting master
131+
# Only run publishing steps when tag is on master branch
119132
- name: Setup CocoaPods trunk authentication
120-
if: (github.ref == 'refs/heads/master') || (github.event_name == 'release' && github.event.release.target_commitish == 'master')
133+
if: steps.check_master.outputs.is_master == 'true'
121134
env:
122135
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
123136
run: |
@@ -138,14 +151,14 @@ jobs:
138151
echo "CocoaPods trunk authentication configured"
139152
140153
- name: Publish NewRelicVideoAgent (core library)
141-
if: (github.ref == 'refs/heads/master') || (github.event_name == 'release' && github.event.release.target_commitish == 'master')
154+
if: steps.check_master.outputs.is_master == 'true'
142155
run: |
143156
echo "Publishing NewRelicVideoAgent (core library)..."
144157
pod trunk push NewRelicVideoAgent.podspec --allow-warnings
145158
echo "NewRelicVideoAgent published successfully!"
146159
147160
- name: Wait for NewRelicVideoAgent to be indexed
148-
if: (github.ref == 'refs/heads/master') || (github.event_name == 'release' && github.event.release.target_commitish == 'master')
161+
if: steps.check_master.outputs.is_master == 'true'
149162
run: |
150163
echo "Waiting for NewRelicVideoAgent to be indexed by CocoaPods..."
151164
echo "This usually takes ~5 minutes..."
@@ -176,14 +189,14 @@ jobs:
176189
echo "You may need to manually verify or retry dependent pods if they fail"
177190
178191
- name: Publish NRAVPlayerTracker (dependent pod)
179-
if: (github.ref == 'refs/heads/master') || (github.event_name == 'release' && github.event.release.target_commitish == 'master')
192+
if: steps.check_master.outputs.is_master == 'true'
180193
run: |
181194
echo "Publishing NRAVPlayerTracker (depends on NewRelicVideoAgent)..."
182195
pod trunk push NRAVPlayerTracker.podspec --allow-warnings
183196
echo "NRAVPlayerTracker published successfully!"
184197
185198
- name: Publish NRIMATracker (dependent pod)
186-
if: (github.ref == 'refs/heads/master') || (github.event_name == 'release' && github.event.release.target_commitish == 'master')
199+
if: steps.check_master.outputs.is_master == 'true'
187200
run: |
188201
echo "Publishing NRIMATracker (depends on NewRelicVideoAgent)..."
189202
pod trunk push NRIMATracker.podspec --allow-warnings

0 commit comments

Comments
 (0)