add CI config

This commit is contained in:
anthorob committed 2025-07-08 12:09:51 -04:00
1 parent 4ab9a392d6
commit d9b1b0f6fd
3 files changed
+55 -1

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
set -euo pipefail
echo "stages:"
echo " - validate"
echo " - deploy"
for dir in templates/*; do
[ -d "$dir" ] || continue
name=$(basename "$dir")
cat <<EOF
validate_${name}:
stage: validate
image: hashicorp/terraform:1.6
script:
- terraform -chdir=$dir init -backend=false
- terraform -chdir=$dir validate
only:
changes:
- $dir/**
deploy_${name}:
stage: deploy
image: registry.bobert.me/anthorob/coder-images:coder-cli
script:
- cd $dir
- coder templates push ${name} --tag "${CI_COMMIT_SHORT_SHA}" --description "Auto-deployed from ${CI_PROJECT_PATH} on commit ${CI_COMMIT_SHORT_SHA}" --latest --yes
only:
refs:
- main
changes:
- $dir/**
EOF
done