feat(pipeline): Add Gitea pipeline back
This commit is contained in:
447
.github/workflows/pipeline.yaml
vendored
447
.github/workflows/pipeline.yaml
vendored
@@ -1,221 +1,226 @@
|
|||||||
#name: CI/CD Pipeline
|
name: CI/CD Pipeline
|
||||||
#run-name: ${{ github.actor }} triggered pipeline on ${{ github.ref_name }}
|
run-name: ${{ github.actor }} triggered pipeline on ${{ github.ref_name }}
|
||||||
#
|
|
||||||
#on:
|
on:
|
||||||
# pull_request:
|
pull_request:
|
||||||
# paths:
|
paths:
|
||||||
# - 'legalconsenthub/**'
|
- 'legalconsenthub/**'
|
||||||
# - 'legalconsenthub-backend/**'
|
- 'legalconsenthub-backend/**'
|
||||||
# - 'api/**'
|
- 'api/**'
|
||||||
# - '.github/workflows/pipeline.yaml'
|
- '.github/workflows/pipeline.yaml'
|
||||||
# push:
|
push:
|
||||||
# branches:
|
branches:
|
||||||
# - main
|
- main
|
||||||
# paths:
|
paths:
|
||||||
# - 'legalconsenthub/**'
|
- 'legalconsenthub/**'
|
||||||
# - 'legalconsenthub-backend/**'
|
- 'legalconsenthub-backend/**'
|
||||||
# - 'api/**'
|
- 'api/**'
|
||||||
# - '.github/workflows/pipeline.yaml'
|
- '.github/workflows/pipeline.yaml'
|
||||||
#
|
|
||||||
#concurrency:
|
concurrency:
|
||||||
# group: ci-${{ github.ref }}
|
group: ci-${{ github.ref }}
|
||||||
# cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
#
|
|
||||||
#jobs:
|
jobs:
|
||||||
# frontend:
|
frontend:
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# defaults:
|
defaults:
|
||||||
# run:
|
run:
|
||||||
# working-directory: ./legalconsenthub
|
working-directory: ./legalconsenthub
|
||||||
#
|
|
||||||
# steps:
|
steps:
|
||||||
# - name: Checkout code
|
- name: Checkout code
|
||||||
# uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
#
|
|
||||||
# - name: Setup Node.js
|
- name: Setup Node.js
|
||||||
# uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
# with:
|
with:
|
||||||
# node-version: '22.16.0'
|
node-version: '22.16.0'
|
||||||
#
|
|
||||||
# - name: Setup Java
|
- name: Setup Java
|
||||||
# uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
# with:
|
with:
|
||||||
# distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
# java-version: '21'
|
java-version: '21'
|
||||||
#
|
|
||||||
# - name: Setup pnpm
|
- name: Setup pnpm
|
||||||
# uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
# with:
|
with:
|
||||||
# version: 10.13.1
|
version: 10.13.1
|
||||||
# run_install: false
|
run_install: false
|
||||||
#
|
|
||||||
# - name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
# id: pnpm-cache
|
id: pnpm-cache
|
||||||
# run: |
|
run: |
|
||||||
# echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||||
#
|
|
||||||
# - name: Setup pnpm cache
|
- name: Setup pnpm cache
|
||||||
# uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
# with:
|
with:
|
||||||
# path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||||
# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
# restore-keys: |
|
restore-keys: |
|
||||||
# ${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
#
|
|
||||||
# - name: Install dependencies
|
- name: Install dependencies
|
||||||
# run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
#
|
|
||||||
# - name: Build application
|
- name: Build application
|
||||||
# run: pnpm build
|
run: pnpm build
|
||||||
#
|
|
||||||
# - name: Run linting
|
- name: Run linting
|
||||||
# run: pnpm lint
|
run: pnpm lint
|
||||||
#
|
|
||||||
# - name: Run type checking
|
- name: Run type checking
|
||||||
# run: pnpm type-check
|
run: pnpm type-check
|
||||||
#
|
|
||||||
# - name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
# uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
#
|
|
||||||
# - name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
# uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
# with:
|
with:
|
||||||
# registry: gitea.lugnas.de
|
registry: git.gremiumhub.de
|
||||||
# username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
# password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
||||||
#
|
|
||||||
# - name: Extract metadata for Docker
|
- name: Extract metadata for Docker
|
||||||
# id: meta
|
id: meta
|
||||||
# uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
# with:
|
with:
|
||||||
# images: gitea.lugnas.de/${{ github.repository_owner }}/legalconsenthub
|
images: git.gremiumhub.de/${{ github.repository_owner }}/legalconsenthub
|
||||||
# tags: |
|
tags: |
|
||||||
# type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||||
# type=sha,prefix=,format=long
|
type=sha,prefix=,format=long
|
||||||
#
|
|
||||||
# - name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
# uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
# with:
|
with:
|
||||||
# context: .
|
context: .
|
||||||
# file: ./legalconsenthub/Dockerfile
|
file: ./legalconsenthub/Dockerfile
|
||||||
# push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||||
# platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
# tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
# labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
# cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache-frontend
|
||||||
# cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache-frontend,mode=max
|
||||||
#
|
|
||||||
# - name: Image built successfully
|
- name: Image built successfully
|
||||||
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
# run: |
|
run: |
|
||||||
# echo "✅ Docker image built and pushed successfully"
|
echo "✅ Docker image built and pushed successfully"
|
||||||
# echo "📦 Image: gitea.lugnas.de/${{ github.repository_owner }}/legalconsenthub:latest"
|
echo "📦 Image: git.gremiumhub.de/${{ github.repository_owner }}/legalconsenthub:latest"
|
||||||
# echo "📦 Image: gitea.lugnas.de/${{ github.repository_owner }}/legalconsenthub:${{ github.sha }}"
|
echo "📦 Image: git.gremiumhub.de/${{ github.repository_owner }}/legalconsenthub:${{ github.sha }}"
|
||||||
#
|
|
||||||
# - name: Dry-run completed
|
- name: Dry-run completed
|
||||||
# if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
# run: |
|
run: |
|
||||||
# echo "✅ Dry-run build completed successfully (image not pushed)"
|
echo "✅ Dry-run build completed successfully (image not pushed)"
|
||||||
#
|
|
||||||
# backend:
|
backend:
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
#
|
|
||||||
# defaults:
|
defaults:
|
||||||
# run:
|
run:
|
||||||
# working-directory: ./legalconsenthub-backend
|
working-directory: ./legalconsenthub-backend
|
||||||
#
|
|
||||||
# steps:
|
steps:
|
||||||
# - name: Checkout code
|
- name: Checkout code
|
||||||
# uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
#
|
|
||||||
# - name: Setup Java
|
- name: Setup Java
|
||||||
# uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
# with:
|
with:
|
||||||
# distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
# java-version: '21'
|
java-version: '21'
|
||||||
#
|
|
||||||
# - name: Setup Gradle cache
|
- name: Setup Gradle cache
|
||||||
# uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
# with:
|
with:
|
||||||
# path: |
|
path: |
|
||||||
# ~/.gradle/caches
|
~/.gradle/caches
|
||||||
# ~/.gradle/wrapper
|
~/.gradle/wrapper
|
||||||
# legalconsenthub-backend/.gradle
|
legalconsenthub-backend/.gradle
|
||||||
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||||
# restore-keys: |
|
restore-keys: |
|
||||||
# ${{ runner.os }}-gradle-
|
${{ runner.os }}-gradle-
|
||||||
#
|
|
||||||
# - name: Build application
|
- name: Build application
|
||||||
# run: ./gradlew build -x test
|
run: ./gradlew build -x test
|
||||||
#
|
|
||||||
# - name: Run ktlint check
|
- name: Run ktlint check
|
||||||
# run: ./gradlew ktlintCheck
|
run: ./gradlew ktlintCheck
|
||||||
#
|
|
||||||
# - name: Run tests
|
- name: Run tests
|
||||||
# run: ./gradlew test
|
run: ./gradlew test
|
||||||
# env:
|
env:
|
||||||
# # Fixes Ryuk testcontainers error during test (https://github.com/testcontainers/testcontainers-java/issues/7036)
|
# Fixes Ryuk testcontainers error during test (https://github.com/testcontainers/testcontainers-java/issues/7036)
|
||||||
# TESTCONTAINERS_HOST_OVERRIDE: host.docker.internal
|
TESTCONTAINERS_HOST_OVERRIDE: host.docker.internal
|
||||||
#
|
|
||||||
# - name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
# uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
#
|
|
||||||
# - name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
# uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
# with:
|
with:
|
||||||
# registry: gitea.lugnas.de
|
registry: git.gremiumhub.de
|
||||||
# username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
# password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
|
||||||
#
|
|
||||||
# - name: Extract metadata for Docker
|
- name: Extract metadata for Docker
|
||||||
# id: meta
|
id: meta
|
||||||
# uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
# with:
|
with:
|
||||||
# images: gitea.lugnas.de/${{ github.repository_owner }}/legalconsenthub-backend
|
images: git.gremiumhub.de/${{ github.repository_owner }}/legalconsenthub-backend
|
||||||
# tags: |
|
tags: |
|
||||||
# type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
||||||
# type=sha,prefix=,format=long
|
type=sha,prefix=,format=long
|
||||||
#
|
|
||||||
# - name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
# uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
# with:
|
with:
|
||||||
# context: .
|
context: .
|
||||||
# file: ./legalconsenthub-backend/Dockerfile
|
file: ./legalconsenthub-backend/Dockerfile
|
||||||
# push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||||
# platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
# tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
# labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
# cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache-backend
|
||||||
# cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache-backend,mode=max
|
||||||
#
|
|
||||||
# - name: Image built successfully
|
- name: Image built successfully
|
||||||
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
# run: |
|
run: |
|
||||||
# echo "✅ Docker image built and pushed successfully"
|
echo "✅ Docker image built and pushed successfully"
|
||||||
# echo "📦 Image: gitea.lugnas.de/${{ github.repository_owner }}/legalconsenthub-backend:latest"
|
echo "📦 Image: git.gremiumhub.de/${{ github.repository_owner }}/legalconsenthub-backend:latest"
|
||||||
# echo "📦 Image: gitea.lugnas.de/${{ github.repository_owner }}/legalconsenthub-backend:${{ github.sha }}"
|
echo "📦 Image: git.gremiumhub.de/${{ github.repository_owner }}/legalconsenthub-backend:${{ github.sha }}"
|
||||||
#
|
|
||||||
# - name: Dry-run completed
|
- name: Dry-run completed
|
||||||
# if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
# run: |
|
run: |
|
||||||
# echo "✅ Dry-run build completed successfully (image not pushed)"
|
echo "✅ Dry-run build completed successfully (image not pushed)"
|
||||||
#
|
|
||||||
# deploy:
|
deploy:
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# needs: [frontend, backend]
|
needs: [frontend, backend]
|
||||||
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
#
|
|
||||||
# steps:
|
steps:
|
||||||
# - name: Checkout code
|
- name: Trigger Coolify redeploy (frontend)
|
||||||
# uses: actions/checkout@v4
|
run: |
|
||||||
#
|
curl -s -X POST \
|
||||||
# - name: Deploy to server
|
-H "Authorization: Bearer ${{ secrets.COOLIFY_DEPLOY_TOKEN }}" \
|
||||||
# run: |
|
"https://coolify.gremiumhub.de/api/v1/deploy?uuid=${{ secrets.COOLIFY_FRONTEND_UUID }}&force=false"
|
||||||
# ssh -i ~/.ssh/id_rsa -p 32766 -o StrictHostKeyChecking=accept-new deploy@ds218 "sudo /usr/local/bin/deployLegalconsenthub.sh"
|
|
||||||
#
|
- name: Trigger Coolify redeploy (backend)
|
||||||
# - name: Deployment successful
|
run: |
|
||||||
# run: |
|
curl -s -X POST \
|
||||||
# echo "✅ Deployment triggered successfully"
|
-H "Authorization: Bearer ${{ secrets.COOLIFY_DEPLOY_TOKEN }}" \
|
||||||
# echo "🚀 Application is being deployed to production"
|
"https://coolify.gremiumhub.de/api/v1/deploy?uuid=${{ secrets.COOLIFY_BACKEND_UUID }}&force=false"
|
||||||
|
|
||||||
|
- name: Deployment triggered
|
||||||
|
run: |
|
||||||
|
echo "✅ Coolify redeployment triggered successfully"
|
||||||
|
echo "🚀 Frontend and backend are being redeployed"
|
||||||
|
|||||||
Reference in New Issue
Block a user