Files
lth-coder-template/.gitea/workflows/test-publish.yaml
T
WilliamSoderberg b159836397
Test & Publish / Test & Publish Template (push) Failing after 2s
Add .gitea/workflows/test-publish.yaml
2026-07-11 15:59:17 +02:00

46 lines
1.5 KiB
YAML

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