Skip to content

Commit

Permalink
Merge pull request #634 from aws-amplify/fix-release-webhook
Browse files Browse the repository at this point in the history
Codebuild web-hook triggers related fixes
  • Loading branch information
phani-srikar authored Jul 17, 2023
2 parents c6d1152 + bd443f6 commit a764821
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .codebuild/scripts/lint_pr.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
set -xeo pipefail
# extract the PR number from the PR link
PR_NUM=${CODEBUILD_WEBHOOK_TRIGGER##*/}
PROJECT_USERNAME=aws-amplify
REPO_NAME=amplify-codegen

if [ -z "$PR_NUM" ]; then
echo "Could not determine PR number. Cannot determine fork point for linting. Skipping linting."
Expand Down
4 changes: 4 additions & 0 deletions .codebuild/scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash -e

if [[ "$CODEBUILD_WEBHOOK_TRIGGER" == "pr/"* ]]; then
BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/}
fi

if [ -z "$BRANCH_NAME" ]; then
echo "BRANCH_NAME is missing"
exit 1
Expand Down
8 changes: 4 additions & 4 deletions scripts/test-swift-modelgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ function buildModels() {

cd ${tempDirectory}/models
for model in */; do
cd ${tempDirectory}/models/$model
echo "Building model $model"
buildAndRunModel $model $pathToSwiftPackage
buildAndRunModel $pathToSwiftPackage
done
}

function buildAndRunModel() {
modelName=$1
pathToSwiftPackage=$2
pathToSwiftPackage=$1

# copy with replace all model files to the swift package
mkdir -p $pathToSwiftPackage/Sources/models
rm -rf $pathToSwiftPackage/Sources/models/*
cp -r $modelName/* $pathToSwiftPackage/Sources/models
cp -r ./* $pathToSwiftPackage/Sources/models
ls $pathToSwiftPackage/Sources/models

# build and run the model
Expand Down
11 changes: 8 additions & 3 deletions shared-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,16 @@ function _publishToLocalRegistry {
echo "Publish To Local Registry"
loadCacheFromBuildJob
if [ -z "$BRANCH_NAME" ]; then
export BRANCH_NAME="$(git symbolic-ref HEAD --short 2>/dev/null)"
if [ "$BRANCH_NAME" = "" ] ; then
BRANCH_NAME="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g')";
if [ -z "$CODEBUILD_WEBHOOK_TRIGGER" ]; then
export BRANCH_NAME="$(git symbolic-ref HEAD --short 2>/dev/null)"
if [ "$BRANCH_NAME" = "" ] ; then
BRANCH_NAME="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g')";
fi
elif [[ "$CODEBUILD_WEBHOOK_TRIGGER" == "pr/"* ]]; then
export BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/}
fi
fi
echo $BRANCH_NAME
git checkout $BRANCH_NAME

# Fetching git tags from upstream
Expand Down

0 comments on commit a764821

Please sign in to comment.