name: Frontend Web - Build & Lint on: push: branches: [main] paths: - "frontend-prep/**" - "docker/frontend/**" pull_request: branches: [main] paths: - "frontend-prep/**" - "docker/frontend/**" jobs: lint-typecheck: name: Lint & Typecheck runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: npm cache-dependency-path: frontend-prep/package-lock.json - name: Install dependencies working-directory: frontend-prep run: npm ci - name: Typecheck working-directory: frontend-prep run: npx tsc -b --noEmit - name: Lint working-directory: frontend-prep run: npm run lint build: name: Build needs: lint-typecheck runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 cache: npm cache-dependency-path: frontend-prep/package-lock.json - name: Install dependencies working-directory: frontend-prep run: npm ci - name: Build working-directory: frontend-prep env: VITE_TOMTOM_API_KEY: ${{ secrets.VITE_TOMTOM_API_KEY }} run: npm run build - name: Upload dist artifact uses: actions/upload-artifact@v4 with: name: frontend-web-dist path: frontend-prep/dist retention-days: 7 docker: name: Docker Build & Push needs: build runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Build & push frontend uses: docker/build-push-action@v6 with: context: . file: docker/frontend/Dockerfile push: true tags: xor1234/frontend-mln:latest deploy: name: SSH Deploy needs: docker runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - name: SSH deploy uses: appleboy/ssh-action@v1 with: host: ${{ secrets.SERVER_HOST_PROD }} username: ${{ secrets.SERVER_USER }} key: ${{ secrets.SERVER_SSH_KEY_PROD }} script: | docker compose -f ${{ secrets.COMPOSE_PATH }} pull frontend docker compose -f ${{ secrets.COMPOSE_PATH }} up -d --no-deps frontend