fix ci
This commit is contained in:
1 parent
ec8c148d1e
commit
ad0aac7b35
1 file changed
+26
-50
+26
-50
@@ -12,43 +12,25 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
checkout:
|
validate:
|
||||||
name: Checkout repository
|
name: Validate templates
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Upload repo files as artifact
|
- name: Setup Terraform
|
||||||
uses: actions/upload-artifact@v3
|
uses: hashicorp/setup-terraform@v2
|
||||||
with:
|
with:
|
||||||
name: source
|
terraform_version: "1.7.0"
|
||||||
path: |
|
|
||||||
base
|
|
||||||
templates
|
|
||||||
|
|
||||||
validate:
|
- name: Terraform validate for each template
|
||||||
name: Validate templates
|
|
||||||
needs: checkout
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Download source artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: source
|
|
||||||
|
|
||||||
- name: Terraform validate for each template (docker)
|
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
for dir in templates/*; do
|
||||||
-v "$PWD":/workspace \
|
[ -d "$dir" ] || continue
|
||||||
-w /workspace \
|
echo "==> validating $dir"
|
||||||
gitea.bobert.me/anthorob/coder-base:terraform sh -c '
|
terraform -chdir="$dir" init -backend=false
|
||||||
for dir in templates/*; do
|
terraform -chdir="$dir" validate
|
||||||
[ -d "$dir" ] || continue
|
done
|
||||||
echo "==> validating $dir"
|
|
||||||
terraform -chdir="$dir" init -backend=false
|
|
||||||
terraform -chdir="$dir" validate
|
|
||||||
done
|
|
||||||
'
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy templates
|
name: Deploy templates
|
||||||
@@ -58,27 +40,21 @@ jobs:
|
|||||||
COMMIT_SHORT_SHA: ${{ github.sha }}
|
COMMIT_SHORT_SHA: ${{ github.sha }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
steps:
|
steps:
|
||||||
- name: Download source artifact
|
- uses: actions/checkout@v4
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: source
|
|
||||||
|
|
||||||
- name: Deploy each template (docker)
|
- name: Install Coder CLI
|
||||||
|
run: |
|
||||||
|
curl -fsSL https://coder.com/install.sh | sh
|
||||||
|
|
||||||
|
- name: Deploy each template
|
||||||
run: |
|
run: |
|
||||||
short_sha=${COMMIT_SHORT_SHA:0:7}
|
short_sha=${COMMIT_SHORT_SHA:0:7}
|
||||||
docker run --rm \
|
for dir in templates/*; do
|
||||||
-v "$PWD":/workspace \
|
[ -d "$dir" ] || continue
|
||||||
-w /workspace \
|
name=$(basename "$dir")
|
||||||
-e COMMIT_SHORT_SHA \
|
display_name=$(echo "$name" | sed "s/.*/\u&/" | sed "s/-/ /g")
|
||||||
-e REPO \
|
|
||||||
gitea.bobert.me/anthorob/coder-base:cli sh -c '
|
|
||||||
for dir in templates/*; do
|
|
||||||
[ -d "$dir" ] || continue
|
|
||||||
name=$(basename "$dir")
|
|
||||||
display_name=$(echo "$name" | sed "s/.*/\u&/" | sed "s/-/ /g")
|
|
||||||
|
|
||||||
echo "==> deploying $name"
|
echo "==> deploying $name"
|
||||||
coder templates push -d "$dir" --name "$short_sha" --message "Auto-deployed from $REPO on commit $short_sha" --yes "$name"
|
coder templates push -d "$dir" --name "$short_sha" --message "Auto-deployed from $REPO on commit $short_sha" --yes "$name"
|
||||||
coder templates edit "$name" --display-name "$display_name Dev Environment" --description "Development environment for $name" --icon "/icon/$name.svg" --yes
|
coder templates edit "$name" --display-name "$display_name Dev Environment" --description "Development environment for $name" --icon "/icon/$name.svg" --yes
|
||||||
done
|
done
|
||||||
'
|
|
||||||
Reference in new issue
Block a user