-
Notifications
You must be signed in to change notification settings - Fork 114
SDK-2937 Automate portion of web cd pipeline #1378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
566a561
fd52bb0
d12bf13
611fccf
acbdfcd
df30978
7657863
e0fa003
19cbabe
453938d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
git clone "https://${GH_TURBINE_TOKEN}@github.com/OneSignal/turbine.git" turbine | ||
cd turbine | ||
|
||
# Configure git identity | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
||
# Create new branch | ||
BRANCH_NAME="web-sdk-${SDK_VERSION}-release" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also, do we have a pre-defined pattern for creating release branches? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @abdulraqeeb33 the branch is created on a different repo, turbine, we need to include web sdk in the branch name somewhere. Turbine does more than host the Web SDK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was following this pattern, https://docs.google.com/document/d/1ekfGZHxYyu04Z5VcE_8vkTWJEQm2e8Ndp-hlFedFM-Q/edit?tab=t.0#heading=h.u6bz69tu00ad There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what we can really reuse since this one goes through turbine There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or can keep it as is. |
||
|
||
# Check if PR already exists | ||
EXISTING_PR=$(curl -s \ | ||
-H "Authorization: Bearer $GH_TURBINE_TOKEN" \ | ||
"https://api.github.com/repos/OneSignal/turbine/pulls?head=OneSignal:$BRANCH_NAME&state=open" | | ||
jq length) | ||
|
||
if [ "$EXISTING_PR" -gt 0 ]; then | ||
echo "PR already exists for branch $BRANCH_NAME" | ||
exit 0 | ||
fi | ||
|
||
git checkout -B "$BRANCH_NAME" | ||
|
||
# Update only USERMODEL_WEB_SDK_VERSION | ||
sed -i "s/USERMODEL_WEB_SDK_VERSION: [a-f0-9]\{40\}/USERMODEL_WEB_SDK_VERSION: ${GITHUB_SHA}/" .circleci/config.yml | ||
|
||
# Check if changes were made | ||
if git diff --exit-code; then | ||
echo "No changes to commit" | ||
exit 0 | ||
fi | ||
|
||
# Commit changes | ||
RELEASE_MESSAGE="Update SDK version to ${SDK_VERSION} for web release" | ||
JOB_MESSAGE="Job that successfully built the artifacts: https://github.com/OneSignal/OneSignal-Website-SDK/actions/runs/${GITHUB_RUN_ID}" | ||
|
||
git add .circleci/config.yml | ||
git commit -m "$RELEASE_MESSAGE" -m "$JOB_MESSAGE" | ||
|
||
# Push to origin (override any existing branch) | ||
git push --force origin "$BRANCH_NAME" | ||
|
||
# Create pull request | ||
PR_NUMBER=$( | ||
curl -sS -X POST \ | ||
-H "Authorization: Bearer $GH_TURBINE_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-d "{ | ||
\"title\": \"$RELEASE_MESSAGE\", | ||
\"body\": \"$JOB_MESSAGE\", | ||
\"head\": \"$BRANCH_NAME\", | ||
\"base\": \"main\" | ||
}" \ | ||
https://api.github.com/repos/OneSignal/turbine/pulls | | ||
jq -r '.number' | ||
) | ||
|
||
# Request team reviewers | ||
curl -sS -X POST \ | ||
-H "Authorization: Bearer $GH_TURBINE_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-d "{ | ||
\"team_reviewers\": [\"eng-sdk-platform\"] | ||
}" \ | ||
"https://api.github.com/repos/OneSignal/turbine/pulls/${PR_NUMBER}/requested_reviewers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fadi-george couldn't we make this work in the GA? instead of having a standalone script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script is kind of long, I didn't want it to be all in the github acitons