diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..3d71ec0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,52 @@ +name: Build and deploy + +concurrency: + group: production + cancel-in-progress: true + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - main + +jobs: + build_and_deploy_job: + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + runs-on: ubuntu-latest + + env: + DOCKER_BUILDKIT: 1 + KAMAL_REGISTRY_PASSWORD: ${{ secrets.KAMAL_REGISTRY_PASSWORD }} + KAMAL_REGISTRY_USERNAME: megasanjay + + name: Build and Deploy Job + steps: + # - name: checkout + # uses: actions/checkout@v + # with: + # submodules: true + # lfs: false + + # - name: Setup kamal secrets file + # run: | + # mkdir -p .kamal + # echo "${{ secrets.KAMAL_REGISTRY_PASSWORD }}" > .kamal/secrets + # echo "${{ secrets.SV }}" > .kamal/secrets + # chmod 600 .kamal/secrets + + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3.0 + bundler-cache: true + - run: gem install kamal + - uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - uses: docker/setup-buildx-action@v3 + - run: kamal lock release + - run: kamal redeploy