Deploy #2
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: Deploy | |
| on: | |
| workflow_dispatch: | |
| workflow_run: | |
| workflows: ["Build and publish container image to GHCR"] | |
| types: [completed] | |
| branches: [main] | |
| concurrency: | |
| group: deploy-production | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| name: Deploy to production | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} | |
| environment: | |
| name: production | |
| timeout-minutes: 30 | |
| permissions: | |
| packages: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 | |
| with: | |
| ruby-version: "3.4" | |
| - name: Install Kamal | |
| run: gem install kamal | |
| - name: Setup SSH agent | |
| uses: webfactory/ssh-agent@a6f90b1f127823b31d4d4a8d96047790581349bd | |
| with: | |
| ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }} | |
| - name: Add server to known hosts | |
| run: ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts | |
| env: | |
| DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} | |
| - name: Deploy with Kamal | |
| env: | |
| DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} | |
| DEPLOY_DOMAIN: ${{ secrets.DEPLOY_DOMAIN }} | |
| DEPLOY_USER: ${{ secrets.DEPLOY_USERNAME }} | |
| KAMAL_REGISTRY_USERNAME: ${{ github.actor }} | |
| KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
| SSL_CERTIFICATE_PEM: ${{ secrets.SSL_CERTIFICATE_PEM }} | |
| SSL_PRIVATE_KEY_PEM: ${{ secrets.SSL_PRIVATE_KEY_PEM }} | |
| run: kamal deploy --skip-push |