Skip to content

Commit 694e31b

Browse files
authored
chore: fix errors for cocoapods release (#505)
1 parent 558b036 commit 694e31b

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

.github/workflows/swift.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ jobs:
8383
xcode-version: 14.1.0
8484
- name: Push to cocoapods.org
8585
env:
86-
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
86+
HOME: 'home/runner'
87+
REPO_SLUG: ${{ github.repository }}
8788
BRANCH: ${{ github.ref_name }}
89+
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
8890
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
8991
COCOAPODS_VERSION: '1.11.3'
9092
run: |

Scripts/run_release.sh

+18-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ set -e
77

88
# COCOAPODS_TRUNK_TOKEN - should be defined in job settings so that we can `pod trunk push`
99

10+
MYREPO=${HOME}/workdir/${REPO_SLUG}
11+
12+
function prep_workspace {
13+
rm -rf ${MYREPO}
14+
mkdir -p ${MYREPO}
15+
git clone -b ${BRANCH} https://${GITHUB_TOKEN}@github.com/${REPO_SLUG} ${MYREPO}
16+
cd ${MYREPO}
17+
}
18+
1019
function release_github {
11-
LAST_RELEASE=$(git describe --abbrev=0 --tags --always)
20+
LAST_RELEASE=$(git describe --abbrev=0 --tags)
21+
1222
if [[ ${LAST_RELEASE} == "v${VERSION}" ]]; then
1323
echo "${LAST_RELEASE} tag exists already (probably created while in the current release process). Skipping..."
1424
return
@@ -32,6 +42,10 @@ function release_github {
3242
}
3343

3444
function release_cocoapods {
45+
46+
# - cocoapods requires ENV['HOME'] with absolute path
47+
HOME=$(pwd)
48+
gem install cocoapods -v $COCOAPODS_VERSION
3549

3650
# ---- Optimizely's pods ----
3751
pods=(OptimizelySwiftSDK);
@@ -44,13 +58,14 @@ function release_cocoapods {
4458
do
4559
podname=${pods[i]};
4660
printf "Pushing the ${podname} pod to COCOAPODS.ORG .\n"
47-
pod trunk push --allow-warnings ${podname}.podspec
48-
pod update
61+
pod _${COCOAPODS_VERSION}_ trunk push --allow-warnings ${podname}.podspec
62+
pod _${COCOAPODS_VERSION}_ update
4963
done
5064

5165
}
5266

5367
function main {
68+
prep_workspace
5469
release_github
5570
release_cocoapods
5671
}

0 commit comments

Comments
 (0)