This commit is contained in:
曾志威
2026-09-24 10:09:13 +08:00
parent 0c6b48ce7f
commit a0c54ac934
3 changed files with 51 additions and 0 deletions
+29
View File
@@ -1,7 +1,36 @@
kind: pipeline
name: default
clone:
disable: true
steps:
- name: clone
image: alpine:3.22
commands:
- apk add --no-cache git ca-certificates
- git --version
- |
set -eu
set +x
test -n "$${DRONE_GIT_HTTP_URL:-}" || { echo 'DRONE_GIT_HTTP_URL is required'; exit 1; }
test -n "$${DRONE_COMMIT_SHA:-}" || { echo 'DRONE_COMMIT_SHA is required'; exit 1; }
if test -n "$${DRONE_NETRC_MACHINE:-}"; then
(umask 077; printf 'machine %s\nlogin %s\npassword %s\n' "$DRONE_NETRC_MACHINE" "$DRONE_NETRC_USERNAME" "$DRONE_NETRC_PASSWORD" > "$HOME/.netrc")
fi
git clone --no-checkout -- "$DRONE_GIT_HTTP_URL" .
printf 'Repository object format: '
git rev-parse --show-object-format
if test -n "$${DRONE_COMMIT_REF:-}"; then
git fetch --no-tags origin "$DRONE_COMMIT_REF"
fi
if ! git cat-file -e "$DRONE_COMMIT_SHA^{commit}" 2>/dev/null; then
git fetch --no-tags origin "$DRONE_COMMIT_SHA"
fi
git checkout --detach "$DRONE_COMMIT_SHA"
test "$(git rev-parse HEAD)" = "$DRONE_COMMIT_SHA" || { echo 'Checked out commit does not match this build'; exit 1; }
git log -1 --format='Checked out commit: %H'
# docker 打包
- name: docker
image: plugins/docker