我有以下两个工作流程:
- 运行测试套件的工作流程
- 使用https://github.com/miloserdow/capistrano-deploy部署代码的工作流程
现在,当我推送我的代码时,两个工作流程都开始了。我希望部署工作仅在测试套件通过后才开始。
我怎样才能做到这一点?
运行测试的工作流程:
name: CI
on:
push:
branches: [setup_github]
jobs:
test:
runs-on: ubuntu-18.04
services:
postgres:
image: postgres:10
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.3
- uses: borales/actions-yarn@v2.0.2
with:
cmd: install
- name: Install Dependencies
run: |
sudo apt-get -yqq install libpq-dev
- name: Install Gems
run: |
gem install bundler
- name: prepare Database
- name: RSpec
run: |
bundle exec rspec specs
部署的工作流程:
name: Deploy on server
on:
push:
branches:
- setup_github
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.3
bundler-cache: true
- uses: miloserdow/capistrano-deploy@master
with:
target: staging
deploy_key: ${{ secrets.DEPLOY_ENC_KEY }}