name: Frontend CI/CD on: push: branches: - main - test jobs: build: runs-on: ubuntu-latest strategy: matrix: project: [web-office] steps: # Output Node.js and npm version - name: Output Node.js and npm version run: | echo "Node.js version:" node -v echo "npm version:" npm -v corepack enable corepack prepare pnpm@latest-9 --activate pnpm config set store-dir .pnpm-store echo "pnpm version:" pnpm -v # Clone repository - name: Clone repository uses: https://gitea.com/actions/checkout@v4 # Cache pnpm dependencies - name: Cache pnpm store uses: https://gitea.com/actions/cache@v3 id: pnpm-cache with: path: .pnpm-store key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- # Install dependencies and build - name: Install dependencies and build run: | ls echo "Installing dependencies..." pnpm install --no-frozen-lockfile echo "Dependencies installed." echo "Building project..." pnpm build --filter ${{ matrix.project }} echo "Project built." # Transfer files to target server - name: Transfer files to target server run: | echo "Transferring files..." mkdir -p ~/.ssh echo "${{ vars.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa cd apps/web-office echo "Local files in the directory:" ls rsync -av --delete -e "ssh -o StrictHostKeyChecking=no -p ${{ vars.REMOTE_PORT }}" dist/ ${{ vars.REMOTE_USER }}@${{ vars.REMOTE_HOST }}:/opt/test echo "Files transferred."