-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.33 KB
/
testbuild.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
on:
push:
branches: ['master']
pull_request:
branches: ['master']
jobs:
build-and-deploy:
name: Production Build & Deployment
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
# Repository auschecken
- name: Check out repository
uses: actions/checkout@v4
# Node.js setzen
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
# Dependencies installieren
- name: Install dependencies
run: yarn install && yarn add autoprefixer
# Next.js-Projekt bauen
- name: Build the Next.js project
run: |
echo "🚀 Starting build..."
yarn build || (echo "❌ Build failed! Full logs:" && cat .next/output.log && exit 1)
# Über SSH deployen, wenn Build erfolgreich war
- name: Deploy to server
if: success()
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }}
run: |
echo "🚀 Deploying to server..."
sshpass -p "$SSH_PASSWORD" ssh -o StrictHostKeyChecking=no "$SSH_USERNAME@$SSH_HOST" "bash /home/nonroot/ci/deploy-innenanzeiger.sh"