Skip to content

update

update #19

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
jobs:
Deploy:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
environment: Production
env:
DOCKER_BUILDKIT: 1
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
IMAGE_NAME: next-carcenter-erding-kamal
RAILS_ENV: production
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Tag
id: tag
run: |
echo "tag=$(git rev-parse "$GITHUB_SHA")" >> $GITHUB_OUTPUT
- name: Build image
uses: docker/build-push-action@v5
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
push: true
labels: |
"service=next-carcenter-erding"
tags: |
"devrico003/next-carcenter-erding-kamal:latest"
"devrico003/next-carcenter-erding-kamal:${{ steps.tag.outputs.tag }}"
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PK }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 2.7.2
- name: Install Kamal
run: gem install kamal
- name: Deploy command
run: kamal deploy --skip-push
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
ENCODED_CREDENTIALS: ${{ secrets.ENCODED_CREDENTIALS }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
NEXTJS_SERVER: ${{ secrets.NEXTJS_SERVER }}
MONGODB_SERVER: ${{ secrets.MONGODB_SERVER }}
SSH_USER: ${{ secrets.SSH_USER }}
SSH_PK: ${{ secrets.SSH_PK }}