Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/build-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build - Production Image

on:
push:
tags:
- "v*.*.*"

jobs:
build-prod:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Set tag
run: echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV

- name: Login to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build backend
run: |
docker build -t ghcr.io/${{ github.repository }}/backend:$TAG ./backend
docker push ghcr.io/${{ github.repository }}/backend:$TAG

- name: Build frontend
run: |
docker build -t ghcr.io/${{ github.repository }}/frontend:$TAG ./frontend
docker push ghcr.io/${{ github.repository }}/frontend:$TAG
45 changes: 45 additions & 0 deletions .github/workflows/cd-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CD - Staging

on:
push:
branches:
- develop

jobs:
deploy-stage:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Set image tag
id: meta
run: echo "TAG=stage-${GITHUB_SHA::7}" >> $GITHUB_ENV

- name: Login to registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set image name
run: echo "IMAGE_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Build backend image
run: |
docker build -t ghcr.io/$IMAGE_NAME/backend:$TAG .
docker push ghcr.io/$IMAGE_NAME/backend:$TAG

- name: Deploy to staging server
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.STAGE_SSH_HOST }}
username: ${{ secrets.STAGE_SSH_USER }}
key: ${{ secrets.STAGE_SSH_KEY }}
script: |
cd /opt/methodologist
echo "BACKEND_IMAGE_TAG=$TAG" > .deploy.env
echo "FRONTEND_IMAGE_TAG=$TAG" >> .deploy.env
docker compose --env-file .deploy.env pull
docker compose --env-file .deploy.env up -d
26 changes: 26 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy - Production (Manual)

on:
workflow_dispatch:
inputs:
version:
description: "Production version tag (e.g. v0.1.7)"
required: true

jobs:
deploy-prod:
runs-on: ubuntu-latest

steps:
- name: Deploy to production
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.PROD_SSH_HOST }}
username: ${{ secrets.PROD_SSH_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
script: |
cd /opt/methodologist
echo "BACKEND_IMAGE_TAG=${{ github.event.inputs.version }}" > .deploy.env
echo "FRONTEND_IMAGE_TAG=${{ github.event.inputs.version }}" >> .deploy.env
docker compose --env-file .deploy.env pull
docker compose --env-file .deploy.env up -d
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ public byte[] getJarfat(String callerEmail, Long id) {
.orElseThrow(() -> new AccessDeniedException(USER_DOSE_NOT_HAVE_ACCESS));

Vsum vsum = vsumUser.getVsum();

if (vsum.getMetaModelRelations() == null || vsum.getMetaModelRelations().isEmpty()) {
throw new NotFoundException(REACTION_FILE_IDS_ID_NOT_FOUND_ERROR);
}
Expand Down
Loading