version: 2 jobs: build: docker: # Pick a base image which matches the version of Node you need for # building from https://hub.docker.com/r/cimg/node/tags # # Note: If using a different container, make sure it contains at least # git 2.6.0. - image: cimg/node:12.6 branches: # Don't build from a branch with the `-built` suffix, to # prevent endless loops of deploy scripts. ignore: - /^.*-built$/ steps: - add_ssh_keys: fingerprints: - "40:8f:0c:e5:83:d5:62:a3:44:1a:e8:0a:1d:fa:44:93" - checkout - run: echo "Building..." - run: name: Create build directory command: mkdir -p build - run: name: Create build readme command: echo "This was built in CI on $(date)" > build/README.md # multiple commands can be combined by starting with the | # do not indent with tabs! - run: name: Add some helpful info to the README command: | echo -e "\n\n## Continuous Integration & Continuous Deployment on VIP Go" >> build/README.md echo -e "\nSee our docs in the [VIP Lobby](https://vip.wordpress.com/documentation/automated-build-and-deploy-on-vip-go/)" >> build/README.md echo -e "\n\nThis branch e.g. master-built is created automatically when " >> build/README.md echo "a commit or merge is made to the base branch e.g. master, using [your CircleCI configuration](../.circleci/config.yml), which you can **customize**" >> build/README.md # Test to ensure the build was good, do not deploy bad stuff! - run: name: Test the build command: | if [ -f build/README.md ]; then echo "Build succeeded"; else echo "Build failed, file missing"; exit 1 fi # Run the deploy: # This will push the result to the {currentbranch}-built branch # Note: if running multiple times, you may need to `git push --delete origin {currentbranch}` between runs to clear out the branch. - deploy: name: Deploy -built branch to github command: ./deploy.sh - run: name: Verify that -built branch was deployed correctly command: ./tests/verify-circle.sh