This commit is contained in:
WinterMyst 2024-09-22 19:32:23 +02:00
parent e5bd48a204
commit 903082c3ca

View File

@ -38,19 +38,18 @@ release:
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
# Decode and set up the SSH private key # Decode and set up the SSH private key
- | - echo $SSH_PRIVATE_KEY_ENCODED | tr -d '\r\n' | base64 --decode > ~/.ssh/id_rsa
printf '%s' $SSH_PRIVATE_KEY_ENCODED | tr -d '\r\n' | base64 --decode > ~/.ssh/id_rsa - if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
echo "Error: Failed to decode SSH_PRIVATE_KEY_BASE64." echo "Error: Failed to decode SSH_PRIVATE_KEY_BASE64."
exit 1 exit 1
fi fi
# Verify the key file # Verify the key file
if [ ! -s ~/.ssh/id_rsa ]; then - if [ ! -s ~/.ssh/id_rsa ]; then
echo "Error: SSH private key file is empty or does not exist." echo "Error: SSH private key file is empty or does not exist."
exit 1 exit 1
fi fi
ssh-keygen -y -f ~/.ssh/id_rsa > /dev/null - ssh-keygen -y -f ~/.ssh/id_rsa > /dev/null
if [ $? -ne 0 ]; then - if [ $? -ne 0 ]; then
echo "Error: Invalid SSH private key." echo "Error: Invalid SSH private key."
exit 1 exit 1
fi fi