-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from guitarrapc/feature/add_workingdir
ci: add working-directory test
- Loading branch information
Showing
3 changed files
with
129 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,17 +99,24 @@ steps: | |
git config --global url."ssh://[email protected]".insteadOf "https://github.com" || true | ||
git config --global gc.auto 0 || true | ||
# Expand `$CIRCLE_WORKING_DIRECTORY`'s ~ to `$HOME` | ||
if [ "$0" == "/bin/sh" ]; then | ||
working_directory=$(echo "$CIRCLE_WORKING_DIRECTORY" | sed -e "s|^~|$HOME|g") | ||
else | ||
working_directory=${CIRCLE_WORKING_DIRECTORY/#\~/$HOME} | ||
fi | ||
# Checkout. SourceCaching? or not. | ||
if [ -e "$CIRCLE_WORKING_DIRECTORY/<< parameters.path >>/.git" ]; then | ||
if [ -e "$working_directory/<< parameters.path >>/.git" ]; then | ||
echo 'Fetching into existing repository' | ||
existing_repo='true' | ||
cd "$CIRCLE_WORKING_DIRECTORY/<< parameters.path >>" | ||
cd "$working_directory/<< parameters.path >>" | ||
git remote set-url origin "$CIRCLE_REPOSITORY_URL" || true | ||
else | ||
echo 'Cloning git repository' | ||
existing_repo='false' | ||
mkdir -p "$CIRCLE_WORKING_DIRECTORY/<< parameters.path >>" | ||
cd "$CIRCLE_WORKING_DIRECTORY/<< parameters.path >>" | ||
mkdir -p "$working_directory/<< parameters.path >>" | ||
cd "$working_directory/<< parameters.path >>" | ||
git clone << parameters.clone_options >> $CIRCLE_REPOSITORY_URL . | ||
fi | ||
|