From 20188bf1984594d1bd8cb80aa2cd1d917e3332be Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Sun, 10 Nov 2024 20:30:35 +0100 Subject: [PATCH] Add GitHub Actions to seed data --- .github/workflows/release-lock-production.yml | 2 +- .github/workflows/seed-production.yml | 26 +++++++++++++++++++ .github/workflows/seed-staging.yml | 26 +++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/seed-production.yml create mode 100644 .github/workflows/seed-staging.yml diff --git a/.github/workflows/release-lock-production.yml b/.github/workflows/release-lock-production.yml index 817834ac..f0bcb4fb 100644 --- a/.github/workflows/release-lock-production.yml +++ b/.github/workflows/release-lock-production.yml @@ -19,5 +19,5 @@ jobs: with: bundler: default bundler-cache: true - - name: Deploy to Staging + - name: Deploy to Production run: bundle exec kamal lock release diff --git a/.github/workflows/seed-production.yml b/.github/workflows/seed-production.yml new file mode 100644 index 00000000..b3879ef7 --- /dev/null +++ b/.github/workflows/seed-production.yml @@ -0,0 +1,26 @@ +name: Seed Production + +on: workflow_dispatch + +jobs: + seed-production: + name: Seed Production + runs-on: ubuntu-20.04 + timeout-minutes: 5 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler: default + bundler-cache: true + + - name: Run db:seed on Production + run: bundle exec kamal app exec --reuse "bin/rails db:seed" diff --git a/.github/workflows/seed-staging.yml b/.github/workflows/seed-staging.yml new file mode 100644 index 00000000..1f8ef881 --- /dev/null +++ b/.github/workflows/seed-staging.yml @@ -0,0 +1,26 @@ +name: Seed Staging + +on: workflow_dispatch + +jobs: + seed-staging: + name: Seed Staging + runs-on: ubuntu-20.04 + timeout-minutes: 5 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup SSH + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler: default + bundler-cache: true + + - name: Run db:seed on Staging + run: bundle exec kamal app exec --reuse "bin/rails db:seed" -d staging