.circleci/config.yml in qiita_trend-0.3.6 vs .circleci/config.yml in qiita_trend-0.3.7

- old
+ new

@@ -2,25 +2,21 @@ executors: base: docker: - image: circleci/ruby:2.6.0 environment: - BUNDLE_PATH: vendor/bundle - working_directory: ~/repo + # Bundlerのパス設定が書き換えられ`vendor/bundle`ではなくて`/usr/local/bundle`を参照してしまい`bundle exec`でエラーになる + # Bundlerのconfigファイル(pathの設定がされたもの)をworkspaceで永続化し`vendor/bundle`を参照するようにするための設定 + BUNDLE_APP_CONFIG: .bundle + working_directory: ~/dodonki1223/qiita_trend commands: - # ref:https://discuss.circleci.com/t/using-bundler-2-0-during-ci-fails/27411 install-bundler: steps: - run: - name: Install Bundler - command: | - echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV - source $BASH_ENV - gem install bundler - # Which version of bundler? - bundle -v + name: Install bundler(2.1.0) + command: gem install bundler:2.1.0 # Read about caching dependencies: https://circleci.com/docs/2.0/caching/ restore-gem-cache: steps: - restore_cache: @@ -42,10 +38,23 @@ - save_cache: paths: - ./vendor/bundle key: v1-dependencies-{{ checksum "Gemfile.lock" }} + save-workspace: + steps: + - persist_to_workspace: + # working_directory からの相対パスか絶対パスを指定します + root: . + paths: . + + using-workspace: + steps: + - attach_workspace: + # working_directory からの相対パスか絶対パスを指定します + at: . + run-rubocop: steps: - run: name: Run RuboCop command: | @@ -87,17 +96,32 @@ - store_artifacts: # ドキュメントの結果をyard-resultsディレクトリに吐き出す path: ./doc destination: yard-results - # Deploy RubyGems deploy-rubygems: steps: + # ref:https://support.circleci.com/hc/ja/articles/115015628247-%E6%8E%A5%E7%B6%9A%E3%82%92%E7%B6%9A%E8%A1%8C%E3%81%97%E3%81%BE%E3%81%99%E3%81%8B-%E3%81%AF%E3%81%84-%E3%81%84%E3%81%84%E3%81%88- + # read/write両方の権限が必要 + - add_ssh_keys: + fingerprints: + - "38:d2:72:5e:9f:67:93:9a:ec:95:94:a2:0e:bf:41:9e" + + # ref:https://circleci.com/docs/2.0/gh-bb-integration/#establishing-the-authenticity-of-an-ssh-host - run: + name: Avoid hosts unknown for github + command: | + mkdir -p ~/.ssh + echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== + bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw== + ' >> ~/.ssh/known_hosts + + - run: name: Deploy RubyGems command: | - curl -u dodonki1223:$RUBYGEMS_PASSWORD https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials + curl -u dodonki1223:$RUBYGEMS_PASSWORD https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials + chmod 0600 ~/.gem/credentials git config user.name dodonki1223 git config user.email $RUBYGEMS_EMAIL bundle exec rake build bundle exec rake release @@ -108,34 +132,32 @@ - checkout - install-bundler - restore-gem-cache - install-gem - save-gem-cache + - save-workspace lint: executor: base steps: - - checkout + - using-workspace - install-bundler - - restore-gem-cache - run-rubocop test: executor: base steps: - - checkout + - using-workspace - install-bundler - - restore-gem-cache - run-tests - create-document - collect-reports deploy: executor: base steps: - - checkout + - using-workspace - install-bundler - - restore-gem-cache - deploy-rubygems workflows: version: 2.1 main: