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:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
REGISTRY_URL: docker-registry:5000
|
||||
IMAGE_NAME: michaelschiemer
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
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
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
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
|
||||
- name: Success
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY_URL }} -u admin --password-stdin
|
||||
|
||||
- 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 }}"
|
||||
echo "🎉 Checkout successful!"
|
||||
ls -la
|
||||
|
||||
Reference in New Issue
Block a user