From b15983639741e6b6de54edb0ec069bc5afc26f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20S=C3=B6derberg?= Date: Sat, 11 Jul 2026 15:59:17 +0200 Subject: [PATCH] Add .gitea/workflows/test-publish.yaml --- .gitea/workflows/test-publish.yaml | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .gitea/workflows/test-publish.yaml diff --git a/.gitea/workflows/test-publish.yaml b/.gitea/workflows/test-publish.yaml new file mode 100644 index 0000000..7ea98ce --- /dev/null +++ b/.gitea/workflows/test-publish.yaml @@ -0,0 +1,46 @@ +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 \ No newline at end of file