🤖 feat: simplify CI/CD structure and add Docker workflow
Some checks failed
Some checks failed
- Rename ci-cd.yaml to go-ci-cd.yaml for clarity - Add dockerimage.yaml workflow for Docker builds - Create Dockerfile for production deployment - Add comprehensive CI/CD documentation - Create contributor-quickstart.sh for easy validation - Update all scripts to handle both workflow files - Fix event triggers to run on all relevant pushes - Remove redundant YAML syntax validation - Improve workflow validation for Arcodange conventions BREAKING CHANGE: ci-cd.yaml renamed to go-ci-cd.yaml See scripts/cicd/README.md for complete documentation. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
83
.gitea/workflows/dockerimage.yaml
Normal file
83
.gitea/workflows/dockerimage.yaml
Normal file
@@ -0,0 +1,83 @@
|
||||
---
|
||||
# DanceLessonsCoach Docker Image Build Workflow
|
||||
# Based on Arcodange webapp conventions
|
||||
# Builds and publishes Docker images to Gitea Container Registry
|
||||
|
||||
name: Docker Build and Publish
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'doc/**'
|
||||
- 'adr/**'
|
||||
- '.gitea/**'
|
||||
|
||||
# cancel any previously-started, yet still active runs of this workflow on the same branch
|
||||
concurrency:
|
||||
group: ${{ github.ref }}-${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Arcodange-specific environment variables
|
||||
env:
|
||||
GITEA_INTERNAL: "https://gitea.arcodange.lab/"
|
||||
GITEA_EXTERNAL: "https://gitea.arcodange.fr/"
|
||||
GITEA_ORG: "arcodange"
|
||||
GITEA_REPO: "DanceLessonsCoach"
|
||||
CI_REGISTRY: "gitea.arcodange.lab"
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
name: Build and Push Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.CI_REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push image to Gitea Container Registry
|
||||
run: |-
|
||||
# Determine tags based on event type
|
||||
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
# For tags, use the tag name and latest
|
||||
TAGS="${{ github.ref_name }} latest"
|
||||
else
|
||||
# For main branch, use commit SHA and latest
|
||||
TAGS="latest ${{ github.sha }}"
|
||||
fi
|
||||
|
||||
echo "Building Docker image with tags: $TAGS"
|
||||
docker build -t dance-lessons-coach .
|
||||
|
||||
for TAG in $TAGS; do
|
||||
IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$TAG"
|
||||
echo "Tagging and pushing: $IMAGE_NAME"
|
||||
docker tag dance-lessons-coach "$IMAGE_NAME"
|
||||
docker push "$IMAGE_NAME"
|
||||
done
|
||||
|
||||
- name: Show published images
|
||||
run: |-
|
||||
echo "📦 Published Docker images:"
|
||||
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:${{ github.ref_name }}"
|
||||
echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:latest"
|
||||
else
|
||||
echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:latest"
|
||||
echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:${{ github.sha }}"
|
||||
fi
|
||||
@@ -3,10 +3,10 @@
|
||||
# Follows Arcodange conventions from webapp workflow
|
||||
# Uses .gitea/workflows/ directory and internal registry
|
||||
|
||||
name: DanceLessonsCoach CI/CD
|
||||
name: Go CI/CD Pipeline
|
||||
|
||||
on:
|
||||
workflow_dispatch: true
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
@@ -18,10 +18,16 @@ on:
|
||||
- 'README.md'
|
||||
- 'doc/**'
|
||||
- 'adr/**'
|
||||
- '.gitea/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types: [opened, synchronize, reopened, labeled]
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'doc/**'
|
||||
- 'adr/**'
|
||||
- '.gitea/**'
|
||||
|
||||
# cancel any previously-started runs of this workflow on the same branch
|
||||
concurrency:
|
||||
@@ -94,7 +100,7 @@ jobs:
|
||||
echo "✅ Code is properly formatted"
|
||||
|
||||
workflow-validation:
|
||||
name: Workflow Validation
|
||||
name: Arcodange Workflow Validation
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'pull_request' || contains(github.ref, 'ci/')
|
||||
|
||||
@@ -102,25 +108,16 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Validate workflow syntax
|
||||
run: |
|
||||
if command -v yq >/dev/null 2>&1; then
|
||||
yq eval '.' .gitea/workflows/ci-cd.yaml > /dev/null
|
||||
echo "✅ Workflow YAML syntax is valid"
|
||||
else
|
||||
echo "⚠️ yq not installed, skipping YAML validation"
|
||||
fi
|
||||
|
||||
- name: Run workflow validation script
|
||||
- name: Run Arcodange workflow validation
|
||||
run: ./scripts/cicd/validate-workflow.sh
|
||||
|
||||
- name: Check for breaking changes
|
||||
- name: Check for workflow changes in PR
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
echo "🔍 Checking workflow changes..."
|
||||
changes=$(git diff origin/main -- .gitea/workflows/ci-cd.yaml | grep -q "^-")
|
||||
changes=$(git diff origin/main -- .gitea/workflows/ | grep -q "^-")
|
||||
if [ $changes ]; then
|
||||
echo "⚠️ Changes detected - review recommended"
|
||||
echo "⚠️ Workflow changes detected - review recommended"
|
||||
else
|
||||
echo "✅ No workflow changes"
|
||||
fi
|
||||
Reference in New Issue
Block a user