Posted by Simon Dong on 2019-10-10
{"trigger":["develop","hexo"],"pool":{"vmImage":"ubuntu-latest"},"steps":[{"checkout":"none","persistCredentials":true,"clean":true},{"script":"git config --global user.email \"snovian@outlook.com\"\ngit config --global user.name \"simon dong\"\n","displayName":"config git"},{"script":"rm -rf _deployer\ngit -c http.$(Build.Repository.Uri).extraheader=\"AUTHORIZATION: bearer $(System.AccessToken)\" clone --depth=50 --branch=hexo $(Build.Repository.Uri) _deployer\ncd _deployer\nrm -rf source/_posts\ngit -c http.$(Build.Repository.Uri).extraheader=\"AUTHORIZATION: bearer $(System.AccessToken)\" submodule add -b develop $(Build.Repository.Uri) source/_posts\nnpm install\nrm -rf ./public\nrm -rf source/images && mv source/_posts/images source/\nsed -i \"s/^build:\\ .*$/build:\\ $(Build.BuildNumber)/\" _config.yml\n./node_modules/hexo-cli/bin/hexo clean\n./node_modules/hexo-cli/bin/hexo generate\ncd public\ngit init\ngit add -v --all .\ngit commit -m \"Azure Pipeline Build @ $(Build.BuildNumber)\"\ngit push -v --force $(BLOG_PUSH) master:master\n","displayName":"Run publish blog","enabled":true}]}