From 5de1eaec6c76a3faed7252663f835f842147b756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20S=C3=B6derberg?= Date: Fri, 3 Oct 2025 15:17:12 +0200 Subject: [PATCH] Implemented a publish workflow --- .github/workflows/publish-template.yaml | 59 +++++++++++++++++++++++++ README.md | 9 ++-- 2 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish-template.yaml diff --git a/.github/workflows/publish-template.yaml b/.github/workflows/publish-template.yaml new file mode 100644 index 0000000..7d4dad0 --- /dev/null +++ b/.github/workflows/publish-template.yaml @@ -0,0 +1,59 @@ +name: Test and Publish Coder Template + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + test-and-publish: + runs-on: ubuntu-latest + env: + TEMPLATE_NAME: "LTH" + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: latest + + - 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: Validate Terraform template + run: terraform validate + + - name: Get short commit SHA to use as template version name + id: name + run: echo "version_name=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + + - name: Get latest commit title to use as template version description + id: message + run: + echo "pr_title=$(git log --format=%s -n 1 ${{ github.sha }})" >> + $GITHUB_OUTPUT + + - name: Push template to Coder + run: | + coder templates push $TEMPLATE_NAME --activate=false --name ${{ steps.name.outputs.version_name }} --message "${{ steps.message.outputs.pr_title }}" --yes + + - name: Create a test workspace and run some example commands + run: | + coder create -t $TEMPLATE_NAME --template-version ${{ steps.name.outputs.version_name }} test-${{ steps.name.outputs.version_name }} --yes + # run some example commands + coder ssh test-${{ steps.name.outputs.version_name }} -- make build + + - name: Delete the test workspace + if: always() + run: coder delete test-${{ steps.name.outputs.version_name }} --yes + + - name: Promote template version + if: success() + run: | + coder template version promote --template=$TEMPLATE_NAME --template-version=${{ steps.name.outputs.version_name }} --yes diff --git a/README.md b/README.md index 271f7c5..964c697 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,12 @@ Create a workspace by pressing the button below! ## Configure X11 capabilities 1. Install a X Server on your device, [X410](https://x410.dev/) is recommended. - -3. Open VS Code and add two entries to the ***coder.sshConfig*** setting (restart VS Code afterwards): - - `ForwardX11 yes` - - `ForwardX11Trusted yes` -> You might need to input the following into a terminal on Windows: `setx DISPLAY "127.0.0.1:0.0"` if the X11 display can't be found. +2. Open VS Code and add two entries to the ***coder.sshConfig*** setting (restart VS Code afterwards): + - `ForwardX11 yes` + - `ForwardX11Trusted yes` +> You might need to input the following into a terminal on Windows: `setx DISPLAY "127.0.0.1:0.0"` if the X11 display can't be found. ## Architecture