Merge pull request #9 from Phipsiart/dependabot/npm_and_yarn/next-15.1.2 #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |