inserted some useful comments #22
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user