Skip to content

Add component for field error, and fix display of form errors #37

Add component for field error, and fix display of form errors

Add component for field error, and fix display of form errors #37

name: Build and Deploy
on:
push:
branches:
- main
workflow_dispatch: # Allows manual execution of the workflow
env:
APP_NAME: planner-app
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
PORT: 3000
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: '1.1.12'
- name: Install dependencies
run: bun install
- name: Run ESLint
run: bun run lint
- name: Build Docker image
run: docker build . -t docker.io/${{ env.DOCKER_USER }}/${{ env.APP_NAME }}:${{ github.sha }}
- name: Login to Docker registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login docker.io -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push Docker image
run: docker push docker.io/${{ env.DOCKER_USER }}/${{ env.APP_NAME }}:${{ github.sha }}
deploy:
needs: build
runs-on: ubuntu-latest
environment: production
steps:
- name: Deploy to remote server
uses: appleboy/ssh-action@master
with:
host: ${{ vars.REMOTE_HOST }}
username: ${{ vars.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
docker pull docker.io/${{ env.DOCKER_USER }}/${{ env.APP_NAME }}:${{ github.sha }}
docker stop ${{ env.APP_NAME }} || true
docker rm ${{ env.APP_NAME }} || true
docker run --init --restart unless-stopped -d -p ${{ env.PORT }}:${{ env.PORT }} --name ${{ env.APP_NAME }} \
--network projects-network \
-e DATABASE_URL=${{ secrets.DATABASE_URL }} \
-e KINDE_DOMAIN=${{ secrets.KINDE_DOMAIN }} \
-e KINDE_CLIENT_ID=${{ secrets.KINDE_CLIENT_ID }} \
-e KINDE_CLIENT_SECRET=${{ secrets.KINDE_CLIENT_SECRET }} \
-e KINDE_REDIRECT_URI=${{ secrets.KINDE_REDIRECT_URI }} \
-e KINDE_LOGOUT_REDIRECT_URI=${{ secrets.KINDE_LOGOUT_REDIRECT_URI }} \
docker.io/${{ env.DOCKER_USER }}/${{ env.APP_NAME }}:${{ github.sha }}