diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/test.yaml index d44ac02..32454da 100644 --- a/.gitea/workflows/test.yaml +++ b/.gitea/workflows/test.yaml @@ -1,9 +1,9 @@ -name: Build with Kaniko +name: Build with Kaniko and Deploy on: [push] jobs: - build-and-push: + build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout @@ -12,20 +12,30 @@ jobs: - name: Build and push with Kaniko uses: aevea/action-kaniko@master with: - # Обязательные параметры registry: harbor.apps.kopikopi.com.ru username: ${{ secrets.HARBOR_USERNAME }} password: ${{ secrets.HARBOR_PASSWORD }} - image: drone/test # Имя образа без registry + image: drone/test tags: latest,${{ gitea.sha }} context: . - dockerfile: Dockerfile - build-args: | - BUILD_DATE=${{ gitea.workflow.created }} - VERSION=${{ gitea.sha }} + dockerfile: Dockerfile # Убедитесь, что Dockerfile существует! + cache: true + + - name: Update infrastructure repository + run: | + # Клонируем team-infra + git clone https://${{ secrets.GITEA_USER }}:${{ secrets.GITEA_TOKEN }}@gitea.apps.kopikopi.com.ru/examples/nginx-intrasture.git + cd team-infra - # Дополнительные флаги для kaniko - extra-args: | - --snapshot-mode=time - --use-new-run - --verbosity=info + # Обновляем тег образа в KubeVela Application + sed -i "s|image:.*drone/test:.*|image: harbor.apps.kopikopi.com.ru/drone/test:${{ gitea.sha }}|g" vela-apps/1-simple/static-site.yaml + + # Коммитим и пушим + git config user.name "CI/CD Bot" + git config user.email "ci-cd@kopikopi.com.ru" + git add . + git commit -m "Update static-site to ${{ gitea.sha }}" + git push + env: + GITEA_USER: ${{ secrets.GITEA_USER }} + GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}