From 8750c81eadc494b60b173fd22c6c2318ea944075 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 12 Jul 2026 15:52:18 +0530 Subject: [PATCH] chore: cherry-pick upstream v1.10..v1.12 Sync stable releases from chuhlomin/render-template. --- .goreleaser.yml | 28 +++++++++++++++ README.md | 10 +++--- action.yml | 5 ++- binary/action.yml | 89 +++++++++++++++++++++++++++++++++++++++++++++++ go.mod | 4 +-- 5 files changed, 126 insertions(+), 10 deletions(-) create mode 100644 .goreleaser.yml create mode 100644 binary/action.yml diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..bd7739d --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,28 @@ +version: 2 + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - arm + goarm: + - "7" + ignore: + - goos: darwin + goarch: arm + - goos: windows + goarch: arm + flags: + - -mod=vendor + ldflags: + - -w -s + +archives: + - formats: [binary] + name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" diff --git a/README.md b/README.md index 49dc6e1..c3c3006 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -[![StepSecurity Maintained Action](https://raw.githubusercontent.com/step-security/maintained-actions-assets/main/assets/maintained-action-banner.png)](https://docs.stepsecurity.io/actions/stepsecurity-maintained-actions) - # Render Template -[![main](https://github.com/step-security/render-template/actions/workflows/main.yml/badge.svg)](https://github.com/step-security/render-template/actions/workflows/main.yml) +[![main](https://github.com/chuhlomin/render-template/actions/workflows/main.yml/badge.svg)](https://github.com/chuhlomin/render-template/actions/workflows/main.yml) +[![release](https://github.com/chuhlomin/render-template/actions/workflows/release.yml/badge.svg)](https://github.com/chuhlomin/render-template/actions/workflows/release.yml) +[![DockerHub](https://img.shields.io/badge/docker-hub-4988CC)](https://hub.docker.com/repository/docker/chuhlomin/render-template) GitHub Action to render file based on template and passed variables. @@ -94,13 +94,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v3 <...> - name: Render template id: render_template - uses: step-security/render-template@v1 + uses: chuhlomin/render-template@v1 with: template: kube.template.yml vars: | diff --git a/action.yml b/action.yml index 5726be6..8299eab 100644 --- a/action.yml +++ b/action.yml @@ -1,7 +1,7 @@ name: Render Template description: Renders file based on template and passed variables -author: step-security +author: Konstantin Chukhlomin branding: icon: file-text @@ -33,6 +33,5 @@ outputs: description: Rendered file content runs: - using: 'docker' + using: docker image: 'docker://ghcr.io/step-security/render-template:v1.10.0@sha256:9c1fc91677928a9f3a4fe0a8eb1a218ca40be178e7c5a4871d754022a54b4c59' #v1.10.0 - diff --git a/binary/action.yml b/binary/action.yml new file mode 100644 index 0000000..5c7ae7a --- /dev/null +++ b/binary/action.yml @@ -0,0 +1,89 @@ +name: Render Template (binary) +description: Renders file based on template and passed variables (uses pre-compiled binary, no Docker required) + +author: Konstantin Chukhlomin + +branding: + icon: file-text + color: purple + +inputs: + template: + description: Path to template + required: true + + vars: + description: Variables to use in template + required: false + + vars_path: + description: Path to YAML file with variables + required: false + + result_path: + description: Desired path to result file (optional) + required: false + + timezone: + description: Timezone to use in `date` template function + required: false + +outputs: + result: + description: Rendered file content + value: ${{ steps.run.outputs.result }} + +runs: + using: composite + steps: + - name: Download binary + shell: bash + env: + GH_TOKEN: ${{ github.token }} + ACTION_REPO: ${{ github.action_repository }} + ACTION_REF: ${{ github.action_ref }} + run: | + OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') + [ "$OS" = "macos" ] && OS="darwin" + ARCH=$(echo "${{ runner.arch }}" | tr '[:upper:]' '[:lower:]') + [ "$ARCH" = "x64" ] && ARCH="amd64" + [ "$ARCH" = "arm" ] && ARCH="armv7" + EXT="" + [ "$OS" = "windows" ] && EXT=".exe" + BINARY="render-template_${OS}_${ARCH}${EXT}" + REPO="${ACTION_REPO:-chuhlomin/render-template}" + DEST="$RUNNER_TEMP/render-template" + mkdir -p "$DEST" + echo "Downloading ${BINARY} from ${REPO}@${ACTION_REF}" + if ! gh release download "${ACTION_REF}" \ + --repo "${REPO}" \ + --pattern "$BINARY" \ + --dir "$DEST" 2>/dev/null; then + echo "'${ACTION_REF}' is not a release tag, resolving to latest '${ACTION_REF}.*'" + RESOLVED_TAG="$(gh release list \ + --repo "${REPO}" \ + --json tagName \ + --jq "first(.[] | select(.tagName | startswith(\"${ACTION_REF}.\"))) | .tagName")" + [ -z "$RESOLVED_TAG" ] && echo "::error::No release found matching '${ACTION_REF}.*'" && exit 1 + echo "Resolved to ${RESOLVED_TAG}" + if ! gh release download "${RESOLVED_TAG}" \ + --repo "${REPO}" \ + --pattern "$BINARY" \ + --dir "$DEST"; then + echo "::error::No asset '${BINARY}' found in release '${RESOLVED_TAG}'" + exit 1 + fi + fi + [ "$OS" != "windows" ] && chmod +x "$DEST/$BINARY" + echo "RENDER_TEMPLATE_BIN=$DEST/$BINARY" >> "$GITHUB_ENV" + + - name: Run + id: run + shell: bash + env: + INPUT_TEMPLATE: ${{ inputs.template }} + INPUT_VARS: ${{ inputs.vars }} + INPUT_VARS_PATH: ${{ inputs.vars_path }} + INPUT_RESULT_PATH: ${{ inputs.result_path }} + INPUT_TIMEZONE: ${{ inputs.timezone }} + run: "${{ env.RENDER_TEMPLATE_BIN }}" diff --git a/go.mod b/go.mod index 238b839..1949dd7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ -module github.com/step-security/render-template +module github.com/chuhlomin/render-template -go 1.24 +go 1.21 require ( github.com/caarlos0/env/v10 v10.0.0