Created
July 7, 2025 20:58
-
-
Save stewones/05708d3b3a15377fd178822e64ac6b6a to your computer and use it in GitHub Desktop.
Kamal Bun Workspace GitHub Action Deploy 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: App Deployment | |
| concurrency: | |
| group: production | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'apps/app/**' | |
| - '.github/workflows/deploy-app.yml' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: app | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| RAILS_ENV: production | |
| KAMAL_REGISTRY_PASSWORD: ${{ secrets.KAMAL_REGISTRY_PASSWORD }} | |
| KAMAL_REGISTRY_USERNAME: ${{ secrets.KAMAL_REGISTRY_USERNAME }} | |
| SSH_KEY: ${{ secrets.SSH_KEY }} | |
| SSH_HOST: ${{ secrets.SSH_HOST }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.3.1 | |
| bundler-cache: true | |
| - run: gem install kamal | |
| - name: Set up SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "$SSH_PRIVATE_KEY" > ~/.ssh/your_key | |
| chmod 600 ~/.ssh/your_key | |
| eval $(ssh-agent -s) | |
| ssh-add ~/.ssh/your_key | |
| ssh-keyscan ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
| env: | |
| SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }} | |
| - run: kamal version | |
| - name: Release Lock | |
| run: cd apps/app && kamal lock release | |
| - name: Set up Docker Buildx for cache | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.KAMAL_REGISTRY_USERNAME }} | |
| password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }} | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.2.10 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Deploy | |
| run: cd apps/app && kamal redeploy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment