-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): push samples to dedicated branches
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
tmp=`mktemp -d` | ||
|
||
for sample in dist/samples/*/; do | ||
name=`basename $sample` | ||
branch="sample/${name}" | ||
|
||
pushd $tmp | ||
rm -rf .git | ||
git init | ||
git config user.name 'gaelsimon' | ||
git config user.email 'gael.simon@woosmap.com' | ||
|
||
if [ -n "$GITHUB_TOKEN" ]; then | ||
git remote add origin "https://gaelsimon:$GITHUB_TOKEN@github.com/woosmap/js-samples.git" | ||
else | ||
git remote add origin "git@github.com:woosmap/js-samples.git" | ||
fi | ||
|
||
git checkout -B $branch | ||
git rm -rqf . || true | ||
git clean -fxd | ||
popd | ||
|
||
cp -r $sample/app/* $tmp | ||
|
||
# manually copy all files beginning with . | ||
cp $sample/app/.env $tmp/.env | ||
cp $sample/app/.eslintrc.json $tmp/.eslintrc.json | ||
cp $sample/app/.gitignore $tmp/.gitignore | ||
|
||
|
||
pushd $tmp | ||
git add -A | ||
git commit -am "chore: sync ${name} [skip-ci]" --no-verify || true | ||
git push -q --set-upstream origin $branch -f | ||
git status | ||
popd | ||
done |