This commit is contained in:
SG
2026-03-31 12:09:52 +03:00
parent 91c0519c64
commit 47b76306b2
2 changed files with 10 additions and 9 deletions

View File

@@ -2,12 +2,12 @@ name: docker-build-push
description: Clone app repo, build Docker image, and push it to the private registry
inputs:
git_base_url:
description: Base Git host without scheme path, for example git.example.com
git_server_url:
description: Full Git server URL, for example https://git.example.com
required: true
git_repository:
description: Repository path, for example example/signup_app
description: Repository path, for example example/testapp
required: true
git_sha:
@@ -24,7 +24,7 @@ inputs:
registry:
description: OCI registry host
required: true
required: false
default: zmeyka.exocortex.ru
registry_user:
@@ -36,7 +36,7 @@ inputs:
required: true
image_name:
description: Image path inside registry, for example example/signup_app
description: Image path inside registry, for example example/testapp
required: true
image_tag:
@@ -59,7 +59,7 @@ runs:
- name: Run build and push script
shell: bash
env:
INPUT_GIT_BASE_URL: ${{ inputs.git_base_url }}
INPUT_GIT_SERVER_URL: ${{ inputs.git_server_url }}
INPUT_GIT_REPOSITORY: ${{ inputs.git_repository }}
INPUT_GIT_SHA: ${{ inputs.git_sha }}
INPUT_GIT_USER: ${{ inputs.git_user }}

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
: "${INPUT_GIT_BASE_URL:?missing INPUT_GIT_BASE_URL}"
: "${INPUT_GIT_SERVER_URL:?missing INPUT_GIT_SERVER_URL}"
: "${INPUT_GIT_REPOSITORY:?missing INPUT_GIT_REPOSITORY}"
: "${INPUT_GIT_SHA:?missing INPUT_GIT_SHA}"
: "${INPUT_GIT_USER:?missing INPUT_GIT_USER}"
@@ -17,7 +17,7 @@ set -euo pipefail
case "${INPUT_IMAGE_NAME}" in
*/*) ;;
*)
echo "INPUT_IMAGE_NAME must include owner/name, for example: example/signup_app" >&2
echo "INPUT_IMAGE_NAME must include owner/name, for example: example/testapp" >&2
exit 1
;;
esac
@@ -38,7 +38,8 @@ mkdir -p "${workdir}"
git init "${workdir}"
cd "${workdir}"
git remote add origin "https://${INPUT_GIT_USER}:${INPUT_GIT_TOKEN}@${INPUT_GIT_BASE_URL}/${INPUT_GIT_REPOSITORY}.git"
git remote add origin "${INPUT_GIT_SERVER_URL}/${INPUT_GIT_REPOSITORY}.git"
git config http.extraHeader "Authorization: Basic $(printf '%s:%s' "${INPUT_GIT_USER}" "${INPUT_GIT_TOKEN}" | base64 -w0)"
git fetch --depth=1 origin "${INPUT_GIT_SHA}"
git checkout --detach FETCH_HEAD