From c39a6ec6263ee3a115dfe6365f388918a676cb77 Mon Sep 17 00:00:00 2001 From: Leon Wilzer Date: Wed, 14 Feb 2024 01:26:33 +0100 Subject: [PATCH] inserted some useful comments --- .drone.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 67c03ef..757a9b4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -116,12 +116,14 @@ steps: - cargo fmt --all --check && echo "No formatting required, exiting early..." && exit 0 - cargo fmt --all --verbose + # Check for format loop - apk add git - '[ "$(git log -1 --pretty=%B | grep -E ".+")" = "rustfmt" ] && echo "format loop detected, aborting..." && exit 1' - - apk update + # Get necessary packages - apk add openssh gpg gpg-agent + # configure SSH and import private key - mkdir -p "$${HOME}/.ssh" - echo "$SSH_PRIVATE_KEY" > "$${HOME}/.ssh/git" - echo "Host git.libre.moe" >> "$${HOME}/.ssh/config" @@ -132,6 +134,7 @@ steps: - echo "$GITEA_ECDSA_SIG" >> "$${HOME}/.ssh/known_hosts" - chmod 700 -R "$${HOME}/.ssh" + # setup gpg - gpg-agent --daemon # the git config gpg.program absolutely despises anything other than a path, including additional arguments. # so we just put it into it's own shell script and use that later @@ -139,9 +142,11 @@ steps: - echo gpg --batch --pinentry-mode loopback --passphrase '$GPG_PASSPHRASE' \$@ >> /tmp/gpg.sh - chmod 777 /tmp/gpg.sh + # import gpg key - echo "$GPG_PRIVKEY" > /tmp/private.key - /tmp/gpg.sh --import /tmp/private.key >> /tmp/import.sh || exit 2 + # configure git - git config --local user.name "WANessa" - git config --local user.email "$GIT_EMAIL_ADDRESS" - git config --local user.signingkey "$GPG_PUBKEY_ID" @@ -150,6 +155,7 @@ steps: # - git config core.sshCommand '/usr/bin/ssh -v' - git remote add ssh "$DRONE_GIT_SSH_URL" + # commit and push every modified file, does not include new files, because why should it? - GIT_COMMITTER_NAME="WANessa" GIT_COMMITTER_EMAIL="$GIT_EMAIL_ADDRESS" git commit --author "$DRONE_COMMIT_AUTHOR_NAME <$DRONE_COMMIT_AUTHOR_EMAIL>" -S -a -m "rustfmt" - git push ssh -- 2.45.2