diff --git a/.env.example b/.env.example deleted file mode 100644 index 6adfe90..0000000 --- a/.env.example +++ /dev/null @@ -1 +0,0 @@ -DATABASE_URL="mongodb://example:27017/ementas" diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml deleted file mode 100644 index b93c9f3..0000000 --- a/.github/workflows/ci-cd.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: CI/CD - -on: - push: - branches: - - main - -env: - NODE_VERSION: 22 - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: npm - - name: Install dependencies - run: npm ci - - name: Lint - run: npm run lint - - format: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: npm - - name: Install dependencies - run: npm ci - - name: Format - run: npm run format - - check: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: npm - - name: Install dependencies - run: npm ci - - name: Check - run: npm run check - - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: npm - - name: Install dependencies - run: npm ci - - name: Test - run: npm run test - - build: - runs-on: ubuntu-latest - needs: - - lint - - format - - check - - test - env: - # Just needs to be defined, doesn't need to be a real URL - DATABASE_URL: mongodb://mongo:27017/ementas - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: npm - - name: Install dependencies - run: npm ci - - name: Build - run: npm run build - - deploy: - runs-on: ubuntu-latest - needs: - - build - env: - # Just needs to be defined, doesn't need to be a real URL - DATABASE_URL: mongodb://mongo:27017/ementas - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Login to Docker registry - uses: docker/login-action@v3 - with: - registry: https://registry.toino.pt - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Copy example .env - run: cp .env.example .env - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - push: true - tags: registry.toino.pt/ementas:latest - target: prod diff --git a/.github/workflows/niployments.yml b/.github/workflows/niployments.yml new file mode 100644 index 0000000..704074c --- /dev/null +++ b/.github/workflows/niployments.yml @@ -0,0 +1,21 @@ +name: Deploy + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Upload to NIployments register + uses: NIAEFEUP/push-to-niployments@v2.1 + with: + docker_dockerfile: Dockerfile + docker_context: . + docker_target: prod + NIPLOYMENTS_REGISTRY_URL: ${{ vars.NIPLOYMENTS_REGISTRY_URL }} + NIPLOYMENTS_REGISTRY_USERNAME: ${{ vars.NIPLOYMENTS_REGISTRY_USERNAME }} + NIPLOYMENTS_REGISTRY_PASSWORD: ${{ secrets.NIPLOYMENTS_REGISTRY_PASSWORD }} diff --git a/Dockerfile b/Dockerfile index 650babe..1603189 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,6 @@ COPY package-lock.json . RUN npm ci -COPY .env . COPY postcss.config.js . COPY svelte.config.js . COPY tailwind.config.js . diff --git a/src/lib/server/prisma.ts b/src/lib/server/prisma.ts index 5e3c482..63f8bbd 100644 --- a/src/lib/server/prisma.ts +++ b/src/lib/server/prisma.ts @@ -1,5 +1,4 @@ import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); -await prisma.$connect(); export default prisma;