Skip to content

Commit ee6e09f

Browse files
Copilotandrewb1269
andauthored
Add setup-gomplate input and install gomplate with checksum verification (#51)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: andrewb1269 <184121471+andrewb1269@users.noreply.github.com>
1 parent 738aade commit ee6e09f

3 files changed

Lines changed: 69 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
setup-task: true
6060
task-version: '3.50.0'
6161
task-retries: '3'
62+
setup-gomplate: true
6263

6364
- name: Verify Setup
6465
run: |
@@ -109,6 +110,9 @@ jobs:
109110
echo "Swift SDKs: ${{ steps.test-all.outputs.swift-sdks }}"
110111
swift --version
111112
echo "::endgroup::"
113+
echo "::group::Verify Gomplate Installation"
114+
gomplate --version
115+
echo "::endgroup::"
112116
113117
test-checkout:
114118
name: Test Checkout Action
@@ -358,3 +362,25 @@ jobs:
358362
- name: Verify Task Installation
359363
run: |
360364
task --version
365+
366+
test-setup-gomplate:
367+
name: Test Setup Gomplate
368+
runs-on: ubuntu-latest
369+
steps:
370+
- name: Harden Runner
371+
id: harden-runner
372+
uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1
373+
with:
374+
egress-policy: audit
375+
376+
- name: Checkout Repository
377+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
378+
379+
- name: Run Setup Gomplate Action
380+
uses: ./
381+
with:
382+
setup-gomplate: true
383+
384+
- name: Verify Gomplate Installation
385+
run: |
386+
gomplate --version

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Common steps for initializing a job for GitHub actions. This composite action co
77
- Security hardening with Step Security's Harden Runner
88
- Repository checkout with configurable options
99
- Multi-language support (Node.js, Java, Python, Go, Rust, Swift)
10-
- Build tool setup (Gradle)
10+
- Build tool setup (Gradle, Task, gomplate)
1111
- Automatic caching for dependencies and build artifacts
1212

1313
## Usage
@@ -109,6 +109,15 @@ Common steps for initializing a job for GitHub actions. This composite action co
109109
| task-retries | Number of retries to set up task | No | 3 |
110110
| checkout-token | Personal access token (PAT) used to fetch the repository | No | - |
111111

112+
**Gomplate**
113+
114+
| Input | Description | Required | Default |
115+
|----------------|--------------------------|----------|---------|
116+
| setup-gomplate | Whether to setup gomplate | No | false |
117+
118+
> [!NOTE]
119+
> `setup-gomplate` currently installs the Linux AMD64 gomplate release artifact.
120+
112121
### Outputs
113122

114123
**Checkout Outputs**

action.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ inputs:
120120
description: 'Whether to setup Task'
121121
required: false
122122
default: 'false'
123+
setup-gomplate:
124+
description: 'Whether to setup gomplate'
125+
required: false
126+
default: 'false'
123127
task-version:
124128
description: 'Task version to use'
125129
required: false
@@ -393,6 +397,35 @@ runs:
393397
repo-token: ${{ inputs.checkout-token }}
394398
max-retries: ${{ inputs.task-retries }}
395399

400+
- name: Set Up Gomplate Parameters
401+
id: setup-gomplate-params
402+
if: ${{ inputs.setup-gomplate == 'true' }}
403+
shell: bash
404+
run: |
405+
echo "::group::Setting up gomplate"
406+
echo "Version: v5.0.0"
407+
echo "::endgroup::"
408+
409+
- name: Install Gomplate
410+
id: setup-gomplate
411+
if: ${{ inputs.setup-gomplate == 'true' }}
412+
shell: bash
413+
run: |
414+
GOMPLATE_VERSION="v5.0.0"
415+
GOMPLATE_RELEASE_URL="https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}"
416+
417+
curl -sSfL "${GOMPLATE_RELEASE_URL}/gomplate_linux-amd64" \
418+
-o /tmp/gomplate || { echo "Failed to download gomplate binary"; exit 1; }
419+
curl -sSfL "${GOMPLATE_RELEASE_URL}/checksums-${GOMPLATE_VERSION}_sha256.txt" \
420+
-o /tmp/gomplate_checksums.txt || { echo "Failed to download gomplate checksums"; exit 1; }
421+
EXPECTED_SHA="$(grep 'bin/gomplate_linux-amd64$' /tmp/gomplate_checksums.txt | awk '{print $1}')"
422+
if [ -z "${EXPECTED_SHA}" ]; then
423+
echo "Unable to find checksum for gomplate_linux-amd64"
424+
exit 1
425+
fi
426+
echo "${EXPECTED_SHA} /tmp/gomplate" | sha256sum -c - || { echo "Gomplate checksum verification failed"; exit 1; }
427+
sudo install -m 755 /tmp/gomplate /usr/local/bin/gomplate
428+
396429
branding:
397430
icon: 'arrow-up-right'
398431
color: 'green'

0 commit comments

Comments
 (0)