Implemented a publish workflow
This commit is contained in:
@@ -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
|
||||
@@ -8,13 +8,12 @@ Create a workspace by pressing the button below!
|
||||
|
||||
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`
|
||||
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
|
||||
|
||||
This template provisions the following resources:
|
||||
|
||||
Reference in New Issue
Block a user