From bbc5c9985da4d45ea1d1b4849f27267c5a078be7 Mon Sep 17 00:00:00 2001 From: Andrii Date: Thu, 21 Nov 2024 14:49:15 +0200 Subject: [PATCH] split CI --- .github/workflows/ci.yml | 5 ++++- .github/workflows/production.yml | 26 ++++++++++++++++++++++++++ .github/workflows/rubocop.yml | 18 ++++++++++++++++++ .github/workflows/staging.yml | 26 ++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/production.yml create mode 100644 .github/workflows/rubocop.yml create mode 100644 .github/workflows/staging.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05b3114a8..f2b326da3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ -name: CI +name: Rspec on: + workflow_run: + workflows: + - Rubocop push: pull_request: diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml new file mode 100644 index 000000000..d361aec7d --- /dev/null +++ b/.github/workflows/production.yml @@ -0,0 +1,26 @@ +name: Production + +on: + branches: + - master + + release: + types: [published] + +jobs: + deploy-to-production: + runs-on: ubuntu-latest + if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3.5 + bundler-cache: true + + - uses: miloserdow/capistrano-deploy@v3 + with: + target: production + deploy_key: ${{ secrets.PROD_DEPLOY_KEY }} diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 000000000..cea8b37da --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,18 @@ +name: Rubocop + +on: + push: + +jobs: + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3.5 + bundler-cache: true + cache-version: 1 + - name: Run rubocop + run: | + bundle exec rubocop diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml new file mode 100644 index 000000000..dfd77a5ac --- /dev/null +++ b/.github/workflows/staging.yml @@ -0,0 +1,26 @@ +name: Staging + +on: + branches: + - develop + types: + - closed + +jobs: + deploy-to-staging: + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3.5 + bundler-cache: true + + - uses: miloserdow/capistrano-deploy@v3 + with: + target: staging + deploy_key: ${{ secrets.STAGING_KEY_PASSWORD }} + enc_rsa_key_pth: config/credentials/staging_deploy_id_ed25519_enc