name: Deploy on: push: branches: - master jobs: deploy: name: Deploy runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2.3.4 # Build step goes here - uses: actions/setup-node@v2 with: node-version: "14" name: Setup node - run: npm run build # Example build command name: Build website - name: Deploy run: | set -ex git config --global user.email "support+actions@github.com" git config --global user.name "github-actions-bot" REPO="$HOME/$REPO_NAME" PROJECT_NAME="${GITHUB_REPOSITORY/${AUTHOR_NAME}\//}" git clone "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${AUTHOR_NAME}/${REPO_NAME}.git" "$REPO" rm -rf "$REPO/$PROJECT_NAME" cp -r build "$REPO/$PROJECT_NAME" cd "$REPO" git add . git diff-index --quiet HEAD || git commit --message "Deploy $PROJECT_NAME" git push "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${AUTHOR_NAME}/${REPO_NAME}.git" env: GITHUB_TOKEN: ${{ secrets.DEPLOY_PAT }} AUTHOR_NAME: AuthorNameGoesHere REPO_NAME: BuildRepoNameGoesHere GITHUB_USERNAME: UsernameOfPATGoesHere