Merge pull request 'dev' (#1) from dev into main
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 14s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 14s
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
62
.gitea/workflows/deploy.yml
Normal file
62
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
name: Build and Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: debian-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Repository auschecken
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Abhängigkeiten installieren
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
# --- BRANCH-SPEZIFISCHE VARIABLEN SETZEN ---
|
||||||
|
|
||||||
|
- name: Konfiguration für Produktiv (main)
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
run: |
|
||||||
|
echo "ASTRO_SITE_URL=https://iten.pro" >> $GITHUB_ENV
|
||||||
|
echo "ASTRO_BASE_PATH=/" >> $GITHUB_ENV
|
||||||
|
echo "DEPLOY_HOST=ssh.netzone.ch" >> $GITHUB_ENV
|
||||||
|
echo "TARGET_PATH=~/htdocs/" >> $GITHUB_ENV
|
||||||
|
echo "DEPLOY_USER=${{ secrets.PROD_SSH_USERNAME }}" >> $GITHUB_ENV
|
||||||
|
echo "DEPLOY_KEY<<EOF" >> $GITHUB_ENV
|
||||||
|
echo "${{ secrets.PROD_SSH_PRIVATE_KEY }}" >> $GITHUB_ENV
|
||||||
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Konfiguration für Test (dev)
|
||||||
|
if: github.ref == 'refs/heads/dev'
|
||||||
|
run: |
|
||||||
|
echo "ASTRO_SITE_URL=https://home.iten.pro" >> $GITHUB_ENV
|
||||||
|
echo "ASTRO_BASE_PATH=/test" >> $GITHUB_ENV
|
||||||
|
echo "DEPLOY_HOST=10.0.10.107" >> $GITHUB_ENV
|
||||||
|
echo "TARGET_PATH=/var/www/pages/test" >> $GITHUB_ENV
|
||||||
|
echo "DEPLOY_USER=${{ secrets.DEV_SSH_USERNAME }}" >> $GITHUB_ENV
|
||||||
|
echo "DEPLOY_KEY<<EOF" >> $GITHUB_ENV
|
||||||
|
echo "${{ secrets.DEV_SSH_PRIVATE_KEY }}" >> $GITHUB_ENV
|
||||||
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# --- BUILD UND DEPLOYMENT ---
|
||||||
|
|
||||||
|
- name: Astro Build ausführen
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: SSH-Umgebung vorbereiten
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "$DEPLOY_KEY" > ~/.ssh/deploy_key
|
||||||
|
chmod 600 ~/.ssh/deploy_key
|
||||||
|
# Nutzt nun die dynamische Host-Variable
|
||||||
|
ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Deploy via rsync
|
||||||
|
run: |
|
||||||
|
# Nutzt DEPLOY_USER, DEPLOY_HOST und TARGET_PATH
|
||||||
|
rsync -avz --delete -e "ssh -p 22 -i ~/.ssh/deploy_key" dist/ $DEPLOY_USER@$DEPLOY_HOST:$TARGET_PATH
|
||||||
@@ -5,6 +5,8 @@ import tailwindcss from '@tailwindcss/vite';
|
|||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
site: process.env.ASTRO_SITE_URL || 'http://localhost:4321',
|
||||||
|
base: process.env.ASTRO_BASE_PATH || '/',
|
||||||
vite: {
|
vite: {
|
||||||
plugins: [tailwindcss()]
|
plugins: [tailwindcss()]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user