Updates file adding the code to push

This commit is contained in:
cpina 2020-03-29 17:07:19 +02:00
parent d17570f574
commit 8956a2d3f2
2 changed files with 32 additions and 4 deletions

View File

@ -1,5 +1,7 @@
FROM alpine:3.10 FROM alpine:3.10
RUN apk add --no-cache git
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,7 +1,33 @@
#!/bin/sh -l #!/bin/sh -l
echo "Starts" echo "Starts"
echo "1: $1" FOLDER="$1"
echo "2: $2" GITHUB_USERNAME="$2"
echo "3: $3" GITHUB_REPO="$3"
echo "Ends
git config --global user.email "carles@pina.cat"
git config --global user.name "$GITHUB_USERNAME"
git clone "https://$API_TOKEN_GITHUB@github.com/$GITHUB_USERNAME/$GITHUB_REPO.git" "$CLONE_DIR"
ls -l
cd "$CLONE_DIR"
# find needs to be in the git repository directory
find . | grep -v ".git" | grep -v "^\.*$" | xargs rm -rf # delete all files (to handle deletions)
cp -r "../$FOLDER"/* .
echo "After cd $CLONE_DIR"
ls -la
git add .
git commit --message "Update from $GITHUB_REPOSITORY"
git push origin master
cd ..
echo "Done!"
echo "Ends"