This commit is contained in:
parent
4a1ee59b85
commit
6a9f799df0
4 changed files with 13 additions and 12 deletions
|
@ -26,12 +26,12 @@ jobs:
|
||||||
uses: https://git.44net.ch/actions/docker-run-action@main
|
uses: https://git.44net.ch/actions/docker-run-action@main
|
||||||
with:
|
with:
|
||||||
image: debian:11-slim
|
image: debian:11-slim
|
||||||
volumes: |
|
volumes: >-
|
||||||
/tmp/:/tmp/
|
/tmp/:/tmp/
|
||||||
README.md:/README.md
|
README.md:/README.md
|
||||||
options: |
|
options: >-
|
||||||
-e TESTENV=${{ gitea.workspace }}
|
-e TESTENV=${{ gitea.workspace }}
|
||||||
-e TESTENV2=TESTENV2
|
-e TESTENV2=TESTENV2
|
||||||
run: |
|
run: >-
|
||||||
/bin/sh -c
|
/bin/sh -c
|
||||||
echo "test"
|
echo "test"
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
image: some-image:latest
|
image: some-image:latest
|
||||||
volumes: |
|
volumes: >-
|
||||||
./testscript.sh:/testscript.sh
|
./testscript.sh:/testscript.sh
|
||||||
/abc/def:/tmp
|
/abc/def:/tmp
|
||||||
options: |
|
options: >-
|
||||||
--user abc
|
--user abc
|
||||||
run: |
|
run: >-
|
||||||
/bin/bash
|
/bin/bash
|
||||||
/testscript.sh
|
/testscript.sh
|
||||||
```
|
```
|
||||||
|
@ -67,7 +67,7 @@ _Note: The shell must be installed in the container_
|
||||||
with:
|
with:
|
||||||
image: docker:latest
|
image: docker:latest
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: >-
|
||||||
echo "first line"
|
echo "first line"
|
||||||
echo "second line"
|
echo "second line"
|
||||||
```
|
```
|
||||||
|
|
|
@ -10,7 +10,7 @@ env | grep -v -E "^(#|;| |PATH|SHLVL|HOSTNAME|DOCKER_*)" | awk '$1 ~ /^\w+=/' |
|
||||||
|
|
||||||
# login to container registry
|
# login to container registry
|
||||||
if [ -n "${INPUT_USERNAME}" ]; then
|
if [ -n "${INPUT_USERNAME}" ]; then
|
||||||
printf '%s' "${INPUT_PASSWORD}" | docker login "${INPUT_REGISTRY}" -u "${INPUT_USERNAME}" --password-stdin
|
printf '%s' "'${INPUT_PASSWORD}'" | docker login "${INPUT_REGISTRY}" -u "${INPUT_USERNAME}" --password-stdin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set custom network
|
# set custom network
|
||||||
|
@ -24,19 +24,19 @@ if [ "${INPUT_MOUNT_SOCKET,,}" == "true" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# map volumes
|
# map volumes
|
||||||
mapfile -t TMP_VOLUMES < <(printf '%b' "${INPUT_VOLUMES}")
|
mapfile -t -d ' ' TMP_VOLUMES < <(printf '%s' "${INPUT_VOLUMES}")
|
||||||
for vol in "${TMP_VOLUMES[@]}"; do
|
for vol in "${TMP_VOLUMES[@]}"; do
|
||||||
RUNTIME_OPTIONS+=(--volume "${vol}")
|
RUNTIME_OPTIONS+=(--volume "${vol}")
|
||||||
done
|
done
|
||||||
|
|
||||||
# get custom options
|
# get custom options
|
||||||
mapfile -t TMP_OPTIONS < <(printf '%b' "${INPUT_OPTIONS}")
|
mapfile -t -d ' ' TMP_OPTIONS < <(printf '%s' "${INPUT_OPTIONS}")
|
||||||
for opt in "${TMP_OPTIONS[@]}"; do
|
for opt in "${TMP_OPTIONS[@]}"; do
|
||||||
CUSTOM_OPTIONS+=("${opt}")
|
CUSTOM_OPTIONS+=("${opt}")
|
||||||
done
|
done
|
||||||
|
|
||||||
# get run command
|
# get run command
|
||||||
mapfile -t TMP_RUN < <(printf '%b' "${INPUT_RUN}")
|
mapfile -t -d ' ' TMP_RUN < <(printf '%s' "${INPUT_RUN}")
|
||||||
for cmd in "${TMP_RUN[@]}"; do
|
for cmd in "${TMP_RUN[@]}"; do
|
||||||
RUN_COMMAND+=("${cmd}")
|
RUN_COMMAND+=("${cmd}")
|
||||||
done
|
done
|
||||||
|
|
3
test.yml
3
test.yml
|
@ -1,5 +1,6 @@
|
||||||
a:
|
a:
|
||||||
b: |
|
b: >-
|
||||||
|
-e test22
|
||||||
test
|
test
|
||||||
test2
|
test2
|
||||||
test3
|
test3
|
||||||
|
|
Reference in a new issue