[CircleCI]GithubにマージされたらEC2にデプロイする

LINEで送る
Pocket

version: 2
jobs:
 build:
   machine:
     image: circleci/classic:edge
   steps:
     - checkout
# EC2にSSH接続し、デプロイを実行
 deploy:
   machine:
     image: circleci/classic:edge
   steps:
     - checkout
     # CircleCIに登録した秘密鍵を呼び出す。
     - add_ssh_keys:
         fingerprints:
           - “a1:cb:22:d4:5f:bc:88:90:21:b7:34:15:2f:6f:05:f0”
     - run: ssh ${USER_NAME}@${HOST_NAME} ‘git pull origin master && sudo /usr/local/bin/docker-compose up’
# テストが成功した場合のみ、deployを実行
workflows:
 version: 2
 build_and_deploy:
   jobs:
     - build
     - deploy:
         requires:
           - build
         # masterブランチがpushされた場合のみdeploy
         filters:
           branches:
             only: master

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *