Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…a-api into dev
  • Loading branch information
Hirushan99 committed Jul 29, 2024
2 parents 8113e93 + 63e1e0b commit a2b92f7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 38 deletions.
69 changes: 34 additions & 35 deletions .github/workflows/digitalocean-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
name: Deploy NestJS API to DigitalOcean

on:
push:
branches:
- main

env:
DOCKER_SERVICE_NAME: unknown
DOCKER_REPO: unknown
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
passsword: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ env.DOCKER_REPO }}

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Updating docker image
uses: appleboy/[email protected]
with:
host: ${{ secrets.DROPLET_SSH_HOST }}
username: ${{ secrets.DROPLET_SSH_USERNAME }}
key: ${{ secrets.DROPLET_SSH_KEY }}
script: |
docker service update --image "${{ env.DOCKER_REPO }}:latest" ${{ env.DOCKER_SERVICE_NAME }}
deploy:
runs-on: ubuntu-latest
environment: WeatherKids_PROD
steps:
- name: Pull changes into server
uses: appleboy/[email protected]
with:
host: ${{ secrets.DROPLET_SSH_HOST }}
username: ${{ secrets.DROPLET_SSH_USERNAME }}
key: ${{ secrets.DROPLET_SSH_KEY }}
script: |
# Variables
REPO_URL="https://github.com/gaveshalabs/weatherkids-data-api"
TARGET_DIR="weatherkids-data-api"
# Check if the target directory exists
if [ -d "$TARGET_DIR" ]; then
echo "Directory $TARGET_DIR exists. Performing git pull."
cd "$TARGET_DIR"
git pull
else
echo "Directory $TARGET_DIR does not exist. Cloning repository."
git clone "$REPO_URL" "$TARGET_DIR"
cp .env.prod "$TARGET_DIR/.env.prod"
cd "$TARGET_DIR"
fi
nvm use 20
npm ci --only=production
npm run build
node dist/index.js
echo 'Deployment Done!'
2 changes: 1 addition & 1 deletion .github/workflows/firebase-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy NestJS API to Firebase
on:
push:
branches:
- main
# - main
- dev

jobs:
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/modules/common/guards/gavesha-client.guard.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
Injectable,
CanActivate,
ExecutionContext,
HttpException,
Injectable,
} from '@nestjs/common';
import { TokenService } from '../../users/token/token.service';

Expand Down

0 comments on commit a2b92f7

Please sign in to comment.