chore: update ci-cd.yml
This commit is contained in:
@@ -1,85 +1,29 @@
|
|||||||
name: CI/CD Pipeline für michaelschiemer.de
|
name: Minimal Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, develop ]
|
branches: [ main, develop ]
|
||||||
pull_request:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY_URL: docker-registry:5000
|
|
||||||
IMAGE_NAME: michaelschiemer
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Basic Test
|
||||||
|
run: |
|
||||||
|
echo "✅ Workflow is running!"
|
||||||
|
echo "Container environment:"
|
||||||
|
uname -a
|
||||||
|
echo "Available commands:"
|
||||||
|
which docker || echo "Docker not available"
|
||||||
|
which git || echo "Git not available"
|
||||||
|
echo "Network test:"
|
||||||
|
curl --connect-timeout 5 http://gitea:3000 || echo "Cannot reach gitea"
|
||||||
|
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Success
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '18'
|
|
||||||
|
|
||||||
- name: Setup PHP
|
|
||||||
uses: shivammathur/setup-php@v2
|
|
||||||
with:
|
|
||||||
php-version: '8.4'
|
|
||||||
extensions: gd, zip, pdo, pdo_mysql, opcache, pcntl, posix, shmop, redis
|
|
||||||
tools: composer
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
|
||||||
|
|
||||||
- name: Build Frontend Assets
|
|
||||||
run: npm install && npm run build
|
|
||||||
|
|
||||||
# Basic test without external services for now
|
|
||||||
- name: Run PHP CS Fixer (Check)
|
|
||||||
run: composer cs || echo "CS check completed"
|
|
||||||
|
|
||||||
build:
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to Private Registry
|
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY_URL }} -u admin --password-stdin
|
echo "🎉 Checkout successful!"
|
||||||
|
ls -la
|
||||||
- name: Determine Image Tag
|
|
||||||
id: tag
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
||||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "tag=develop" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build Test Image
|
|
||||||
run: |
|
|
||||||
# Create a simple test Dockerfile if none exists
|
|
||||||
if [ ! -f docker/php/Dockerfile ]; then
|
|
||||||
mkdir -p docker/php
|
|
||||||
cat > docker/php/Dockerfile << 'EOF'
|
|
||||||
FROM php:8.4-fpm
|
|
||||||
WORKDIR /var/www
|
|
||||||
COPY . .
|
|
||||||
RUN echo "Test image built successfully"
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Build and push test image
|
|
||||||
docker build -t ${{ env.REGISTRY_URL }}/${{ env.IMAGE_NAME }}/test:${{ steps.tag.outputs.tag }} -f docker/php/Dockerfile .
|
|
||||||
docker push ${{ env.REGISTRY_URL }}/${{ env.IMAGE_NAME }}/test:${{ steps.tag.outputs.tag }}
|
|
||||||
|
|
||||||
- name: Verify Registry Push
|
|
||||||
run: |
|
|
||||||
echo "✅ Successfully built and pushed image to registry"
|
|
||||||
echo "Image: ${{ env.REGISTRY_URL }}/${{ env.IMAGE_NAME }}/test:${{ steps.tag.outputs.tag }}"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user