Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,34 @@ jobs:
- name: Verify Gomplate Installation
run: |
gomplate --version

test-setup-gomplate-custom-version:
name: Test Setup Gomplate (custom version)
runs-on: ubuntu-latest
steps:
- name: Harden Runner
id: harden-runner
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
with:
egress-policy: audit

- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Run Setup Gomplate Action (non-default version)
uses: ./
with:
setup-gomplate: true
gomplate-version: v4.3.3

- name: Verify Gomplate Version Matches Input
env:
EXPECTED_VERSION: 4.3.3
run: |
ACTUAL="$(gomplate --version)"
ESCAPED_EXPECTED_VERSION="$(printf '%s\n' "${EXPECTED_VERSION}" | sed 's/[][(){}.^$*+?|\\]/\\&/g')"
echo "gomplate reported: ${ACTUAL}"
if ! echo "${ACTUAL}" | grep -qE "(^|[^0-9.])${ESCAPED_EXPECTED_VERSION}([^0-9.]|$)"; then
echo "Expected gomplate version ${EXPECTED_VERSION}, got: ${ACTUAL}"
exit 1
fi
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ Common steps for initializing a job for GitHub actions. This composite action co

**Gomplate**

| Input | Description | Required | Default |
|----------------|---------------------------|----------|---------|
| setup-gomplate | Whether to setup gomplate | No | false |
| Input | Description | Required | Default |
|------------------|---------------------------------------|----------|---------|
| setup-gomplate | Whether to setup gomplate | No | false |
| gomplate-version | Gomplate version to use (e.g. v5.0.0) | No | v5.0.0 |

> [!NOTE]
> `setup-gomplate` currently installs the Linux AMD64 gomplate release artifact.
Expand Down
15 changes: 13 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ inputs:
description: 'Whether to setup gomplate'
required: false
default: 'false'
gomplate-version:
description: 'Gomplate version to use (e.g. v5.0.0)'
required: false
default: 'v5.0.0'
Comment thread
andrewb1269 marked this conversation as resolved.
task-version:
description: 'Task version to use'
required: false
Expand Down Expand Up @@ -438,17 +442,24 @@ runs:
id: setup-gomplate-params
if: ${{ inputs.setup-gomplate == 'true' }}
shell: bash
env:
GOMPLATE_VERSION: ${{ inputs.gomplate-version }}
run: |
echo "::group::Setting up gomplate"
echo "Version: v5.0.0"
echo "Version: ${GOMPLATE_VERSION}"
echo "::endgroup::"
Comment thread
andrewb1269 marked this conversation as resolved.

- name: Install Gomplate
id: setup-gomplate
if: ${{ inputs.setup-gomplate == 'true' }}
shell: bash
env:
GOMPLATE_VERSION: ${{ inputs.gomplate-version }}
run: |
GOMPLATE_VERSION="v5.0.0"
if [[ ! "${GOMPLATE_VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid gomplate-version: '${GOMPLATE_VERSION}' (expected format vMAJOR.MINOR.PATCH, e.g. v5.0.0)"
Comment thread
andrewb1269 marked this conversation as resolved.
exit 1
fi
Comment thread
andrewb1269 marked this conversation as resolved.
GOMPLATE_RELEASE_URL="https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}"
Comment thread
andrewb1269 marked this conversation as resolved.

curl -sSfL "${GOMPLATE_RELEASE_URL}/gomplate_linux-amd64" \
Expand Down
Loading