From 187ce1b187e8dbd3c0aa69816e3366ef8f5a41cb Mon Sep 17 00:00:00 2001 From: Xor290 Date: Sun, 3 May 2026 20:24:18 +0200 Subject: [PATCH] chore: update pipeline --- .github/workflows/backend-build.yml | 20 ++++++++++++-------- .github/workflows/frontend-admin-build.yml | 9 +++++---- .github/workflows/frontend-client-build.yml | 5 +++-- .github/workflows/frontend-web-build.yml | 18 +++++++++++------- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/.github/workflows/backend-build.yml b/.github/workflows/backend-build.yml index d421fa59..34d2395b 100644 --- a/.github/workflows/backend-build.yml +++ b/.github/workflows/backend-build.yml @@ -2,11 +2,11 @@ name: Backend - Build & Lint on: push: - branches: [pre-prod] + branches: [main, pre-prod] paths: - "backend/**" pull_request: - branches: [pre-prod] + branches: [main, pre-prod] paths: - "backend/**" @@ -58,7 +58,9 @@ jobs: name: Docker Build & Push needs: build runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' + if: > + (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-prod')) || + (github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'pre-prod')) steps: - uses: actions/checkout@v4 @@ -79,7 +81,7 @@ jobs: file: docker/backend/Dockerfile target: runtime push: true - tags: xor1234/backend-mln:latest + tags: xor1234/backend-mln:${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'latest' || 'pre-prod' }} cache-from: type=gha,scope=backend-runtime cache-to: type=gha,mode=max,scope=backend-runtime @@ -90,7 +92,7 @@ jobs: file: docker/backend/Dockerfile target: waf push: true - tags: xor1234/backend-mln:waf + tags: xor1234/backend-mln:${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'waf' || 'waf-pre-prod' }} cache-from: type=gha,scope=backend-waf cache-to: type=gha,mode=max,scope=backend-waf @@ -98,15 +100,17 @@ jobs: name: Deploy to server needs: docker runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' + if: > + (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-prod')) || + (github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'pre-prod')) steps: - name: SSH deploy uses: appleboy/ssh-action@v1 with: - host: ${{ secrets.SERVER_HOST }} + host: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && secrets.SERVER_HOST_PROD || secrets.SERVER_HOST }} username: ${{ secrets.SERVER_USER }} - key: ${{ secrets.SERVER_SSH_KEY }} + key: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && secrets.SERVER_SSH_KEY_PROD || secrets.SERVER_SSH_KEY }} script: | docker compose -f ${{ secrets.COMPOSE_PATH }} pull backend waf docker compose -f ${{ secrets.COMPOSE_PATH }} up -d --no-deps backend waf diff --git a/.github/workflows/frontend-admin-build.yml b/.github/workflows/frontend-admin-build.yml index a4b10ba6..c1ac7c1d 100644 --- a/.github/workflows/frontend-admin-build.yml +++ b/.github/workflows/frontend-admin-build.yml @@ -2,11 +2,11 @@ name: Frontend Admin - EAS Build on: push: - branches: [pre-prod] + branches: [main, pre-prod] paths: - "frontend-admin/**" pull_request: - branches: [pre-prod] + branches: [main, pre-prod] paths: - "frontend-admin/**" @@ -32,9 +32,10 @@ jobs: working-directory: frontend-admin run: npx tsc --noEmit - build-apk-prod: + build-apk-pre-prod: needs: typecheck runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' steps: - uses: actions/checkout@v4 @@ -66,7 +67,7 @@ jobs: working-directory: frontend-admin env: EAS_BUILD_NO_EXPO_GO_WARNING: true - run: eas build --platform android --profile production --non-interactive + run: eas build --platform android --profile pre-production --non-interactive - name: Download production APK working-directory: frontend-admin diff --git a/.github/workflows/frontend-client-build.yml b/.github/workflows/frontend-client-build.yml index 1f048dc0..f35e983a 100644 --- a/.github/workflows/frontend-client-build.yml +++ b/.github/workflows/frontend-client-build.yml @@ -2,11 +2,11 @@ name: Frontend Client - EAS Build on: push: - branches: [pre-prod] + branches: [main, pre-prod] paths: - "mobile/**" pull_request: - branches: [pre-prod] + branches: [main, pre-prod] paths: - "mobile/**" @@ -35,6 +35,7 @@ jobs: build-apk-prod: needs: typecheck runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/frontend-web-build.yml b/.github/workflows/frontend-web-build.yml index b84857b1..36e7aaad 100644 --- a/.github/workflows/frontend-web-build.yml +++ b/.github/workflows/frontend-web-build.yml @@ -2,12 +2,12 @@ name: Frontend Web - Build & Lint on: push: - branches: [pre-prod] + branches: [main, pre-prod] paths: - "frontend-prep/**" - "docker/frontend/**" pull_request: - branches: [pre-prod] + branches: [main, pre-prod] paths: - "frontend-prep/**" - "docker/frontend/**" @@ -68,7 +68,9 @@ jobs: name: Docker Build & Push needs: build runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' + if: > + (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-prod')) || + (github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'pre-prod')) steps: - uses: actions/checkout@v4 @@ -88,7 +90,7 @@ jobs: context: . file: docker/frontend/Dockerfile push: true - tags: xor1234/frontend-mln:latest + tags: xor1234/frontend-mln:${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'latest' || 'pre-prod' }} build-args: | VITE_TOMTOM_API_KEY=${{ secrets.VITE_TOMTOM_API_KEY }} @@ -96,15 +98,17 @@ jobs: name: Deploy to server needs: docker runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' + if: > + (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-prod')) || + (github.event_name == 'pull_request' && (github.base_ref == 'main' || github.base_ref == 'pre-prod')) steps: - name: SSH deploy uses: appleboy/ssh-action@v1 with: - host: ${{ secrets.SERVER_HOST }} + host: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && secrets.SERVER_HOST_PROD || secrets.SERVER_HOST }} username: ${{ secrets.SERVER_USER }} - key: ${{ secrets.SERVER_SSH_KEY }} + key: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && secrets.SERVER_SSH_KEY_PROD || secrets.SERVER_SSH_KEY }} script: | docker compose -f ${{ secrets.COMPOSE_PATH }} pull frontend docker compose -f ${{ secrets.COMPOSE_PATH }} up -d --no-deps frontend