Update .gitea/workflows/publish-template.yaml
Test and Publish Coder Template / Test & Publish Template (push) Failing after 1m49s

This commit is contained in:
2026-07-11 16:12:58 +02:00 Unverified
parent f2c15acddf
commit 04ec0ee1a9
2 changed files with 70 additions and 46 deletions
+70
View File
@@ -0,0 +1,70 @@
name: Test and Publish Coder Template
on:
push:
branches:
- main
workflow_dispatch:
env:
TEMPLATE_NAME: "LTH"
jobs:
test-and-publish:
name: Test & Publish Template
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
- name: Set up Coder CLI
uses: coder/setup-action@v1
with:
access_url: "https://coder.soderberg.tech"
coder_session_token: ${{ secrets.CODER_SESSION_TOKEN }}
- name: Initialize and Validate Terraform
# Coder's example skips 'init', but it's usually safer to include it
# before validation depending on your provider configurations.
run: |
terraform init
terraform validate
- name: Extract Commit Data
id: vars
# Combined the SHA and Title extraction into a single, clean step
run: |
echo "version_name=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "pr_title=$(git log -1 --pretty=format:'%s')" >> $GITHUB_OUTPUT
- name: Push template to Coder
run: |
coder templates push $TEMPLATE_NAME -d ${{ github.workspace }} \
--activate=false \
--name ${{ steps.vars.outputs.version_name }} \
--message "${{ steps.vars.outputs.pr_title }}" \
--yes
- name: Create a test workspace
run: |
coder create -t $TEMPLATE_NAME \
--template-version ${{ steps.vars.outputs.version_name }} \
test-${{ steps.vars.outputs.version_name }} \
--yes \
--parameter "username=TEST-GIT-NAME,user_email=test@test.com"
- name: Delete the test workspace
if: always()
run: coder delete test-${{ steps.vars.outputs.version_name }} --yes || true
- name: Promote template version
if: success()
run: |
coder template version promote \
--template=$TEMPLATE_NAME \
--template-version=${{ steps.vars.outputs.version_name }} \
--yes
-46
View File
@@ -1,46 +0,0 @@
name: Test & Publish
on:
push:
branches:
- main
workflow_dispatch:
env:
TEMPLATE_NAME: "LTH"
CODER_URL: "https://coder.soderberg.tech"
jobs:
test-and-publish:
name: Test & Publish Template
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies (before_script)
run: |
apk add --no-cache curl git
curl -fsSL https://coder.com/install.sh | sh
- name: Map GitLab predefined variables
run: |
echo "CI_COMMIT_SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "CI_COMMIT_TITLE=$(git log -1 --pretty=format:'%s')" >> $GITHUB_ENV
echo "CI_PROJECT_DIR=${{ github.workspace }}" >> $GITHUB_ENV
- name: Run Terraform and Coder tasks (script)
run: |
terraform init
terraform validate
coder templates push $TEMPLATE_NAME -d $CI_PROJECT_DIR --activate=false --name $CI_COMMIT_SHORT_SHA --message "$CI_COMMIT_TITLE" --yes
coder create -t $TEMPLATE_NAME --template-version $CI_COMMIT_SHORT_SHA test-$CI_COMMIT_SHORT_SHA --yes --parameter "username=TEST-GIT-NAME,user_email=test@test.com"
coder template version promote --template=$TEMPLATE_NAME --template-version=$CI_COMMIT_SHORT_SHA
- name: Cleanup Coder workspace (after_script)
if: always()
run: |
coder delete test-$CI_COMMIT_SHORT_SHA --yes || true