Move iOS scripts to xplat

Summary: Move iOS scripts to xplat

Reviewed By: passy

Differential Revision: D8989985

fbshipit-source-id: 1499657f6d9b7e82f26aa8c008951c885756b51d
This commit is contained in:
Pritesh Nandgaonkar
2018-07-26 05:12:09 -07:00
committed by Facebook Github Bot
parent 6c78895b2a
commit 41d0b2eec2
3 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
#!/bin/bash
echo "✨ Updating podspecs with new release..."
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FBSOURCE_DIR="$DIR/../../../../"
XPLAT_SONAR_DIR="$FBSOURCE_DIR/xplat/sonar"
XPLAT_SONAR_GETTING_STARTED_DOC="$XPLAT_SONAR_DIR/docs/getting-started.md"
XPLAT_SONAR_CLIENT_SONAR_PODSPEC="$FBSOURCE_DIR/xplat/sonar-client/Sonar/Sonar.podspec"
SPECS_DIR="$FBSOURCE_DIR/xplat/sonar/Specs"
PODSPEC_PATH="$DIR/../OSSProject/SonarKit.podspec"
PODFILE_PATH="$DIR/../Sample/Podfile"
SONARKIT_VERSION_TAG='sonarkit_version'
OLD_VERSION_POD_ARG=$(< "$PODSPEC_PATH" grep "$SONARKIT_VERSION_TAG =" )
OLD_VERSION="${OLD_VERSION_POD_ARG##* }"
echo "Currently released version is $OLD_VERSION, What should the version of the next release be?"
read -r VERSION
echo "Updating version $VERSION in podspecs, podfiles and in getting started docs..."
# Update Podspec files and podfiles with correct version
sed -i "" "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/g" "$PODSPEC_PATH"
sed -i "" "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/g" "$PODFILE_PATH"
sed -i "" "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/g" "$XPLAT_SONAR_CLIENT_SONAR_PODSPEC"
sed -i "" "s/${SONARKIT_VERSION_TAG} = ${OLD_VERSION}/${SONARKIT_VERSION_TAG} = '${VERSION}'/g" "$XPLAT_SONAR_GETTING_STARTED_DOC"
# Copy Podfiles
mkdir "$SPECS_DIR/SonarKit/$VERSION" # New Specs dir for SonarKit podspec
mkdir "$SPECS_DIR/Sonar/$VERSION" # New Specs dir for Sonar podspec
cp "$PODSPEC_PATH" "$SPECS_DIR/SonarKit/$VERSION" # Copied SonarKit podspec
cp "$XPLAT_SONAR_CLIENT_SONAR_PODSPEC" "$SPECS_DIR/Sonar/$VERSION" # Copied Sonar podspec

View File

@@ -0,0 +1,33 @@
{
"command": "SandcastleUniversalCommand",
"user": "__USER__",
"args": {
"name": "Release public Sonar build",
"oncall": "danielbuechele",
"steps": [
{
"name": "Clone from GitHub",
"required": true,
"shell": "git -c http.proxy=fwdproxy:8080 -c https.proxy=fwdproxy:8080 clone https://github.com/facebook/Sonar.git ../xplat/sonar-public"
},
{
"name": "Publish to github",
"required": true,
"shell": "curl -o RELEASE.json -x fwdproxy:8080 --silent --data '{ \"tag_name\": \"v__VERSION__\", \"target_commitish\": \"master\", \"name\": \"v__VERSION__\", \"body\": \"\", \"draft\": false, \"prerelease\": true}' https://api.github.com/repos/facebook/Sonar/releases?access_token=$(secrets_tool get SONAR_GITHUB_TOKEN)",
"shell_type": "SandcastleLocalShell"
}
]
},
"alias": "sonar_release_ios_public_build",
"capabilities": {
"vcs": "fbcode-fbsource",
"type": "lego-mac"
},
"hash": "master",
"report": [
{
"type": "email",
"report_to_owner": true
}
]
}

View File

@@ -0,0 +1,17 @@
#!/bin/bash
echo "✨ Creating new Sonar iOS release on GitHub..."
echo "What should the patch version of the next release be?"
read -r VERSION
TMP_DIR=$(mktemp -d)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
JSON=$(cat "$DIR/public-ios-release.json")
JSON=${JSON/__VERSION__/$VERSION}
JSON=${JSON/__VERSION__/$VERSION}
JSON=${JSON/__USER__/$USER}
echo "$JSON" > "$TMP_DIR/job.json"
scutil create "$TMP_DIR/job.json"
echo "✅ GitHub release will be automatically created once the Sandcastle job finishes."
rm -rf "$TMP_DIR"