Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
arrow-up-circle

GitHub Action

Update Coder Template

v2.0.3

Update Coder Template

arrow-up-circle

Update Coder Template

An action to deploy changes to your coder template automatically

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Update Coder Template

uses: matifali/[email protected]

Learn more about this action in matifali/update-coder-template

Choose a version

Update Coder Template

Update coder templates automatically

Usage

  1. Create a github secret named CODER_SESSION_TOKEN with your coder session token
  2. create .github/workflows/ci.yml directory and file locally. Copy and paste the configuration from below, replacing the values as needed.

Inputs

Name Description Default
CODER_ACCESS_URL Required The url of coder deployment (e.g. https://dev.coder.com). -
CODER_SESSION_TOKEN Required The session token of coder. secrets.CODER_SESSION_TOKEN
CODER_TEMPLATE_NAME Required The name of template. -
CODER_TEMPLATE_DIR The directory of template. CODER_TEMPLATE_NAME
CODER_TEMPLATE_VERSION The version of template. -
CODER_TEMPLATE_ACTIVATE Activate the template after update. true

Examples

  1. Update template with latest commit hash as version and activate it.

    name: Update Coder Template
    
    on:
      push:
        branches:
          - main
    
    jobs:
        update:
            runs-on: ubuntu-latest
            steps:
            - name: Checkout
              uses: actions/checkout@v3
            - name: Get latest commit hash
              id: latest_commit
              run: echo "::set-output name=hash::$(git rev-parse --short HEAD)"
    
            - name: Update Coder Template
                uses: matifali/update-coder-template@latest
                with:
                    CODER_TEMPLATE_NAME: "my-template"
                    CODER_TEMPLATE_DIR: "my-template"
                    CODER_ACCESS_URL: "https://coder.example.com"
                    CODER_TEMPLATE_VERSION: "${{ steps.latest_commit.outputs.hash }}"
                    CODER_SESSION_TOKEN: ${{ secrets.CODER_SESSION_TOKEN }}
  2. Update template with a random version name and don't activate it.

    name: Update Coder Template
    
    on:
      push:
        branches:
          - main
    
    jobs:
        update:
            runs-on: ubuntu-latest
            steps:
            - name: Checkout
              uses: actions/checkout@v3
    
            - name: Update Coder Template
                uses: matifali/update-coder-template@latest
                with:
                    CODER_TEMPLATE_NAME: "my-template"
                    CODER_TEMPLATE_DIR: "my-template"
                    CODER_ACCESS_URL: "https://coder.example.com"
                    CODER_TEMPLATE_ACTIVATE: "false"
                    CODER_SESSION_TOKEN: ${{ secrets.CODER_SESSION_TOKEN }}