Skip to content

Commit 63c0c1c

Browse files
committed
SDK-11 Test against a temp branch
1 parent e056c48 commit 63c0c1c

File tree

1 file changed

+51
-33
lines changed

1 file changed

+51
-33
lines changed

.github/workflows/update-spm.yml

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,75 @@ on:
66
version:
77
description: 'Version number'
88
required: true
9+
pull_request:
10+
types: [opened, synchronize]
11+
branches:
12+
- main
913

1014
permissions:
1115
id-token: write
12-
contents: read
16+
contents: write
1317

1418
jobs:
1519
update-sdk:
1620
runs-on: macos-latest
1721

1822
steps:
1923
- name: Checkout repository
20-
uses: actions/checkout@v2
24+
uses: actions/checkout@v3
2125

22-
- name: Ensure version input is provided
23-
run: |
24-
if [ -z "${{ github.event.inputs.version }}" ]; then
25-
echo "Error: Version number is required."
26-
exit 1
27-
fi
26+
# - name: Ensure version input is provided
27+
# run: |
28+
# if [ -z "${{ github.event.inputs.version }}" ]; then
29+
# echo "Error: Version number is required."
30+
# exit 1
31+
# fi
2832

29-
- name: Check if version already exists
30-
run: |
31-
VERSION=${{ github.event.inputs.version }}
32-
if [ -d "OsanoConsentManagerSDK/${VERSION}" ]; then
33-
echo "Version ${VERSION} already exists. Exiting."
34-
exit 1
35-
fi
36-
working-directory: ${{ github.workspace }}
33+
# - name: Check if version already exists
34+
# run: |
35+
# # VERSION=${{ github.event.inputs.version }}
36+
# # VERSION=${{ github.event.inputs.version }}
37+
# if [ -d "OsanoConsentManagerSDK/${VERSION}" ]; then
38+
# echo "Version ${VERSION} already exists. Exiting."
39+
# exit 1
40+
# fi
41+
# working-directory: ${{ github.workspace }}
3742

3843
- name: Download SDK zip
3944
run: |
40-
VERSION=${{ github.event.inputs.version }}
45+
# VERSION=${{ github.event.inputs.version }}
46+
VERSION="3.3.2"
4147
URL="https://libraries.osano.com/ios/OsanoConsentManagerSDK/OsanoConsentManagerSDK-${VERSION}.zip"
4248
if ! curl --output /dev/null --silent --head --fail "$URL"; then
4349
echo "Error: SDK zip for version ${VERSION} does not exist at ${URL}. Exiting."
4450
exit 1
4551
fi
4652
curl -L $URL -o OsanoConsentManagerSDK-${VERSION}.zip
53+
working-directory: ${{ github.workspace }}
54+
4755

4856
- name: Compute checksum
4957
run: |
58+
# VERSION=${{ github.event.inputs.version }}
59+
VERSION="3.3.2"
5060
CHECKSUM=$(swift package compute-checksum OsanoConsentManagerSDK-${VERSION}.zip)
5161
echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
5262
rm OsanoConsentManagerSDK-${VERSION}.zip
63+
working-directory: ${{ github.workspace }}
64+
5365

5466
- name: Create new version folder
5567
run: |
56-
VERSION=${{ github.event.inputs.version }}
57-
mkdir -p OsanoConsentManagerSDK/${VERSION}
68+
# VERSION=${{ github.event.inputs.version }}
69+
VERSION="3.3.2"
70+
mkdir -p OsanoConsentManagerSDK/${VERSION}-test
5871
working-directory: ${{ github.workspace }}
5972

6073
- name: Copy template.podspec and update attributes
6174
run: |
62-
cp template.podspec OsanoConsentManagerSDK/${VERSION}/OsanoConsentManagerSDK.podspec
63-
VERSION=${{ github.event.inputs.version }}
75+
# VERSION=${{ github.event.inputs.version }}
76+
VERSION="3.3.2"
77+
cp template.podspec OsanoConsentManagerSDK/${VERSION}-test/OsanoConsentManagerSDK.podspec
6478
URL="https://libraries.osano.com/ios/OsanoConsentManagerSDK/OsanoConsentManagerSDK-${VERSION}.zip"
6579
sed -i '' "s|s.version = '<version>'|s.version = '${VERSION}'|" OsanoConsentManagerSDK/${VERSION}/OsanoConsentManagerSDK.podspec
6680
sed -i '' "s|s.source = { :http => '<path-to-s3-zip>' }|s.source = { :http => '${URL}' }|" OsanoConsentManagerSDK/${VERSION}/OsanoConsentManagerSDK.podspec
@@ -74,25 +88,29 @@ jobs:
7488
sed -i '' "s|checksum: .*|checksum: \"${CHECKSUM}\"|" Package.swift
7589
working-directory: ${{ github.workspace }}
7690

77-
- name: Install GitHub CLI
78-
run: |
79-
brew install gh
91+
# - name: Install GitHub CLI
92+
# run: |
93+
# brew install gh
8094

8195
- name: Create branch and commit changes
8296
run: |
83-
VERSION=${{ github.event.inputs.version }}
84-
BRANCH_NAME="update-osano-sdk-${VERSION}"
97+
# VERSION=${{ github.event.inputs.version }}
98+
VERSION="3.3.2"
99+
BRANCH_NAME="update-osano-sdk-${VERSION}-test"
85100
git config --global user.name 'Osano Automation'
86101
git config --global user.email '[email protected]'
87102
git checkout -b $BRANCH_NAME
88103
git add .
89104
git commit -m "Update OsanoConsentManagerSDK to version $VERSION"
90105
git push origin $BRANCH_NAME
91106
92-
- name: Create Pull Request
93-
run: |
94-
VERSION=${{ github.event.inputs.version }}
95-
BRANCH_NAME="update-osano-sdk-${VERSION}"
96-
gh pr create --title "Update OsanoConsentManagerSDK to version $VERSION" --body "This PR updates the OsanoConsentManagerSDK to version $VERSION." --head $BRANCH_NAME --base main
97-
env:
98-
GITHUB_TOKEN: ${{ secrets.OSANO_GITHUB_ACCESS_TOKEN }}
107+
# - name: Create and push a new git tag
108+
# run: |
109+
# VERSION=${{ github.event.inputs.version }}
110+
# git config --global user.email "Osano Automation"
111+
# git config --global user.name "[email protected]"
112+
# git tag -a "${VERSION}" -m "Release version ${VERSION}"
113+
# git push origin "v${VERSION}"
114+
# env:
115+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
# working-directory: ${{ github.workspace }}

0 commit comments

Comments
 (0)