Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cpanato committed Mar 26, 2024
1 parent dd6ff7d commit a598c76
Showing 1 changed file with 22 additions and 43 deletions.
65 changes: 22 additions & 43 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ runs:
run: |
set -e
debug_args=
debug_args_image="-exc"
debug='${{inputs.debug}}'
if [[ "${debug}" == "true" ]]; then
echo "[πŸ™] Enabling debug logging."
set -x
debug_args="2>/dev/null"
debug_args_image="-ec"
fi
if [[ '${{inputs.command}}' == '' ]]; then
Expand Down Expand Up @@ -55,56 +59,31 @@ runs:
fi
printf "[πŸ™] Building ephemeral container image from Wolfi packages... "
if [[ "${debug}" == "true" ]]; then
docker run --rm \
-v ${PWD}:/work \
-w /work \
'${{ inputs.apko-image }}' \
build \
--arch=x86_64 \
--sbom=false \
wolfi-act.apko.config.yaml \
wolfi-act:latest \
wolfi-act.tar
else
docker run --rm \
-v ${PWD}:/work \
-w /work \
'${{ inputs.apko-image }}' \
build \
--arch=x86_64 \
--sbom=false \
wolfi-act.apko.config.yaml \
wolfi-act:latest \
wolfi-act.tar 2>/dev/null
fi
eval docker run --rm \
-v ${PWD}:/work \
-w /work \
'${{ inputs.apko-image }}' \
build \
--arch=x86_64 \
--sbom=false \
wolfi-act.apko.config.yaml \
wolfi-act:latest \
wolfi-act.tar "${debug_args}"
echo "done."
printf "[πŸ™] Loading ephemeral container image into Docker... "
if [[ "${debug}" == "true" ]]; then
docker load < wolfi-act.tar
else
docker load < wolfi-act.tar >/dev/null
fi
eval docker load < wolfi-act.tar "${debug_args}"
echo "done."
env > wolfi-act.github.env
echo "[πŸ™] Running the following command in ephemeral container image:"
echo '${{ inputs.command }}'
echo "[πŸ™] Output:"
if [[ "${debug}" == "true" ]]; then
docker run -i --rm --platform linux/amd64 \
-v ${PWD}:/work \
-w /work \
--env-file wolfi-act.github.env \
wolfi-act:latest-amd64 \
bash -exc '${{ inputs.command }}'
else
docker run -i --rm --platform linux/amd64 \
-v ${PWD}:/work \
-w /work \
--env-file wolfi-act.github.env \
wolfi-act:latest-amd64 \
bash -ec '${{ inputs.command }}'
fi
docker run -i --rm --platform linux/amd64 \
-v ${PWD}:/work \
-w /work \
--env-file wolfi-act.github.env \
wolfi-act:latest-amd64 \
bash "${debug_args_image}" '${{ inputs.command }}'

0 comments on commit a598c76

Please sign in to comment.