From 400e7b65953a1864ba74d85c9a33d2cd7a843e80 Mon Sep 17 00:00:00 2001 From: mr-forust Date: Thu, 19 Feb 2026 00:36:02 +0100 Subject: [PATCH] Starting learning cicd from scratch Demo gitea action --- .gitea/workflows/ci.yaml | 28 ----------------------- .gitea/workflows/demo.yaml | 19 ++++++++++++++++ .gitea/workflows/deploy.yaml | 44 ------------------------------------ 3 files changed, 19 insertions(+), 72 deletions(-) delete mode 100644 .gitea/workflows/ci.yaml create mode 100644 .gitea/workflows/demo.yaml delete mode 100644 .gitea/workflows/deploy.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml deleted file mode 100644 index 32c87bd..0000000 --- a/.gitea/workflows/ci.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: CI – validate docker composes - -on: - push: - branches: [dev] - pull_request: - branches: [main] - -jobs: - validate: - runs-on: ci - steps: - - name: Install Node and tools - run: | - apk add --no-cache nodejs yamllint docker-cli-compose git - - - uses: actions/checkout@v4 - - - name: Lint all compose files - run: | - find . \( -name "compose.yaml" -o -name "docker-compose.yaml" \) -print0 | xargs -0 yamllint -d "{extends: relaxed, rules: {line-length: disable}}" - - - name: Validate docker compose syntax - run: | - for f in $(find . -name "compose.yaml" -o -name "docker-compose.yaml"); do - echo "Checking: $f" - docker compose -f "$f" config -q - done diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml new file mode 100644 index 0000000..b1be6e9 --- /dev/null +++ b/.gitea/workflows/demo.yaml @@ -0,0 +1,19 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +jobs: + Explore-Gitea-Actions: + runs-on: dev + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" + - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ gitea.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml deleted file mode 100644 index 0d25ea5..0000000 --- a/.gitea/workflows/deploy.yaml +++ /dev/null @@ -1,44 +0,0 @@ -name: CD – staged deploy - -on: - push: - branches: [main] - -jobs: - detect-changes: - runs-on: deploy - outputs: - services: ${{ steps.set-matrix.outputs.services }} - steps: - - name: Fix git ownership and Fetch - run: | - git config --global --add safe.directory /srv/homelab - cd /srv/homelab - git fetch origin main - git reset --hard origin/main - - - id: set-matrix - name: Generate service list - run: | - cd /srv/homelab - # Собираем список папок в JSON-массив для матрицы - DIRS=$(git diff --name-only HEAD~1 HEAD | cut -d/ -f1 | sort -u | xargs -I{} sh -c 'if [ -f {}/compose.yaml ] || [ -f {}/docker-compose.yaml ]; then echo \"{}\"; fi' | paste -sd,) - echo "services=[$DIRS]" >> $GITEA_OUTPUT - - apply-deploy: - needs: detect-changes - if: needs.detect-changes.outputs.services != '[]' - runs-on: deploy - strategy: - matrix: - service: ${{ fromJson(needs.detect-changes.outputs.services) }} - fail-fast: false - - name: Deploy ${{ matrix.service }} - steps: - - name: Deploy Service - run: | - cd /srv/homelab/${{ matrix.service }} - echo "Syncing and starting ${{ matrix.service }}..." - docker compose pull - docker compose up -d --remove-orphans