Update .gitea/workflows/publish-template.yaml
Test and Publish Coder Template / Test & Publish Template (push) Failing after 1m49s
Test and Publish Coder Template / Test & Publish Template (push) Failing after 1m49s
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user