diff --git a/action-deploy.sh b/action-deploy.sh new file mode 100644 index 00000000..66eb0b34 --- /dev/null +++ b/action-deploy.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +if [ -n "${GITHUB_TOKEN}" ]; then + print_info "setup with GITHUB_TOKEN" + remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git" +elif [ -n "${PERSONAL_TOKEN}" ]; then + print_info "setup with PERSONAL_TOKEN" + remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git" +fi + +if ! git config --get user.name; then + git config --global user.name "${GITHUB_ACTOR}" +fi + +if ! git config --get user.email; then + git config --global user.email "${GITHUB_ACTOR}@users.noreply.${GITHUB_DOMAIN:-"github.com"}" +fi + +cd dist + +git init -b deploy + +git add . + +git commit -m "automatic deployment" + +git remote add origin "${remote_repo}" + +git push -u origin deploy --force