Support env input as KEY=VALUE lines
This commit is contained in:
20
.github/workflows/docker-build-publish.yml
vendored
20
.github/workflows/docker-build-publish.yml
vendored
@@ -19,6 +19,13 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
|
env:
|
||||||
|
description: >
|
||||||
|
Multiline env vars, one per line: KEY=VALUE
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
|
||||||
trivy_severity:
|
trivy_severity:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
@@ -44,6 +51,19 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Load env vars
|
||||||
|
if: ${{ inputs.env != '' }}
|
||||||
|
run: |
|
||||||
|
while IFS= read -r line; do
|
||||||
|
[ -z "$line" ] && continue
|
||||||
|
case "$line" in \#*) continue;; esac
|
||||||
|
if [[ "$line" != *=* ]]; then
|
||||||
|
echo "Invalid env line: $line" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "$line" >> "$GITHUB_ENV"
|
||||||
|
done <<< "${{ inputs.env }}"
|
||||||
|
|
||||||
- name: Start ssh-agent
|
- name: Start ssh-agent
|
||||||
if: ${{ secrets.ssh_private_key != '' }}
|
if: ${{ secrets.ssh_private_key != '' }}
|
||||||
uses: webfactory/ssh-agent@v0.9.0
|
uses: webfactory/ssh-agent@v0.9.0
|
||||||
|
|||||||
Reference in New Issue
Block a user