I'll make a bat file with goes deploy my site on GitHub pages. The repository is heinpauwelyn.github.io and is made with Angular-CLI. To deploy the site I could use this command:
ng github-pages:deploy
This will place everything on the gh-pages
branch but it must stand on the master
branch! I'm developing on the development
branch.
To automate the proceedings of committing, deploying, checkout gh-pages
, copy-pasting, checkout master
, copy-pasting, committing and checkout development
, I've create this bat file named deploy.bat
:
git status
git add *
git commit -m "deploy"
git pull
git push
ng github-pages:deploy
git checkout gh-pages
echo "copy all your files in this folder to a temporary folder outside this repository (except these inside the `.gitignore` file)"
pause
rem must be automatic done by using this xcopy . ..\temp
git checkout master
echo "copy all your file form the temporary folder back into the repository"
pause
rem rmdir /s /q .
rem xcopy ..\temp .
git status
git add *
git commit -m "deploy"
git pull
git push
echo "site is deployed!"
git checkout development
The code will stop on this line: ng github-pages:deploy
. I've checked the syntax on Wikipedia and have seen that the colon is a label to skip code from a running batch file. I think this colon gives the bug.
My question is now can I escape the colon from the batch file so that it's not longer a label but a command?
Note
The goal of the batch file is that I just must use one command to deploy my full site. In the package.json
file of my project, I use this code:
{
"scripts": {
"deploy": "deploy.bat"
}
}
When the bug will be solved, I just use command below to deploy my site on the master
branch.
npm run deploy