Skip to content

Deploy to Digital Ocean #156

Deploy to Digital Ocean

Deploy to Digital Ocean #156

Workflow file for this run

name: Deploy to Digital Ocean
permissions:
id-token: write
contents: read
packages: write
on:
workflow_dispatch:
push:
branches:
- main # Change to 'main' branch
# Trigger deployment only after the CI workflow completes successfully
workflow_run:
workflows: ["CI"] # Ensure this matches the name of your CI workflow
types:
- completed
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production # Adjust to 'production'
timeout-minutes: 20
# Only run if CI was successful
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
env:
BUNDLE_GEMFILE: ./Gemfile
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Install kamal and create binstub
run: |
bundle install
bundle binstub kamal
- uses: docker/setup-buildx-action@v3
- uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.DROPLET_SSH_PRIVATE_KEY }}
- name: Deploy with Kamal
env:
KAMAL_HOST: ${{ secrets.KAMAL_HOST }}
KAMAL_REGISTRY_USERNAME: ${{ secrets.KAMAL_REGISTRY_USERNAME }}
KAMAL_REGISTRY_PASSWORD: ${{ secrets.KAMAL_REGISTRY_PASSWORD }}
SECRET_KEY_BASE: ${{ secrets.SECRET_KEY_BASE }}
AXIOM_API_KEY: ${{ secrets.AXIOM_API_KEY }}
DO_TOKEN: ${{ secrets.DO_TOKEN }}
SPACES_REGION: ${{ secrets.SPACES_REGION }}
SPACES_BUCKET_NAME: ${{ secrets.SPACES_BUCKET_NAME }}
SPACES_BUCKET_CONTENT: ${{ secrets.SPACES_BUCKET_CONTENT }}
SPACES_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }}
SPACES_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
DOCKER_BUILDKIT: 1
run: |
./bin/kamal deploy