diff --git a/base-cicd-example.yml b/base-cicd-example.yml new file mode 100644 index 0000000..0bb8f67 --- /dev/null +++ b/base-cicd-example.yml @@ -0,0 +1,44 @@ +name: Build Docker Image + +on: + push: + branches: + - main # Run when commit on main + - 'feature/*' # Run when commit on all feature branches + tags: + - '*' # Run on all tags creation + +jobs: + +## Build docker image + build: + uses: devops/gitea-actions-templates/.gitea/workflows/docker-build-and-push.yaml@develop + with: + APP_NAME: greedy-qr-bot ## Application name + DOCKERFILE_PATH: Dockerfile ## Dockerfile path + REGISTRY: registry.project-rent-dev.com ## Registry url + secrets: + VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }} ## Vault token path in gitea + +### Run prisma migrations + migration: + needs: build + uses: devops/gitea-actions-templates/.gitea/workflows/prisma-migrate.yaml@develop + with: + PROD_PRISMA_SECRET_DB_PATH: prisma/data/greedy-qr-bot prod-db-url ## Path to prisma db url in vault + DEV_PRISMA_SECRET_DB_PATH: prisma/data/greedy-qr-bot dev-db-url ## Path to prisma db url in vault + secrets: + VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }} ## Vault token path in gitea + +### Deploy app in k8s + deploy: + needs: [migration, build] + uses: devops/gitea-actions-templates/.gitea/workflows/k8s-deploy.yml@develop + with: + APP_NAME: greedy-qr-bot ## Application name + PROD_KUBECONF_SECRET_PATH: cicd/data/kubeconfig prod ## Path to k8s prod conf + DEV_KUBECONF_SECRET_PATH: cicd/data/kubeconfig dev ## Path to k8s dev conf + DEV_NAMESPACE: greedy-dev ## Dev namespace + secrets: + VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }} ## Vault token path in gitea +