Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Update rit publish repo formulas (#373)
Browse files Browse the repository at this point in the history
* merge master

* resolve conflicts

* merge upstream

* update rit publish repo formulas

Signed-off-by: GuillaumeFalourd <[email protected]>

* correct linter

Signed-off-by: GuillaumeFalourd <[email protected]>
  • Loading branch information
GuillaumeFalourd authored Jul 26, 2021
1 parent a62b142 commit 35d5ef6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 5 additions & 8 deletions github/publish/repo/src/unix/formula/formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ formatPackageName() {
echo "$1" | tr "." "/"
}

parse_git_branch() {
echo | git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}

runFormula() {

slug_name=$(createSlug "$PROJECT_NAME")
Expand All @@ -48,8 +44,7 @@ runFormula() {

echo "---------------------------------------------------------------------------"

branch=$(parse_git_branch)
echo "🌱 Using branch: $branch"
git config --global init.defaultBranch main

if git rev-parse --git-dir > /dev/null 2>&1; then
echo "🚧 This repository already exists. Preparing new commit..."
Expand All @@ -72,10 +67,12 @@ runFormula() {
git remote add origin https://$USERNAME:$TOKEN@github.com/$USERNAME/$slug_name.git
fi

git push origin $branch > /dev/null
branch=$(echo | git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
echo "🌱 Using branch: $branch"
git push -u origin $branch > /dev/null

if [[ $DOCKER_EXECUTION ]]; then
chown 1000:1000 -R $CURRENT_PWD/$slug_name
chown 1000:1000 -R $CURRENT_PWD/$slug_name > /dev/null
fi

echo "---------------------------------------------------------------------------"
Expand Down
11 changes: 6 additions & 5 deletions gitlab/publish/repo/src/unix/formula/formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ runFormula() {
cd $WORKSPACE_PATH

if [ $? != 0 ]; then
cd -
exit 1
cd -
exit 1
fi

echo "---------------------------------------------------------------------------"

branch=$(parse_git_branch)
echo "🌱 Using branch: $branch"
git config --global init.defaultBranch main

if git rev-parse --git-dir > /dev/null 2>&1; then
echo "🚧 This repository already exists. Preparing new commit..."
Expand All @@ -68,7 +67,9 @@ runFormula() {
git remote add origin https://oauth2:$TOKEN@gitlab.com/$USERNAME/$slug_name.git
fi

git push origin $branch > /dev/null
branch=$(echo | git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
echo "🌱 Using branch: $branch"
git push -u origin $branch > /dev/null

if [[ $DOCKER_EXECUTION ]]; then
chown 1000:1000 -R $CURRENT_PWD/$slug_name
Expand Down

0 comments on commit 35d5ef6

Please sign in to comment.