chore: fix gpg key import
This commit is contained in:
@@ -6,6 +6,7 @@ RUN apt-get update && apt-get install -y \
|
|||||||
ca-certificates \
|
ca-certificates \
|
||||||
gnupg \
|
gnupg \
|
||||||
lsb-release \
|
lsb-release \
|
||||||
|
ca-certificates \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Bun as the node user
|
# Install Bun as the node user
|
||||||
|
@@ -45,7 +45,7 @@ chmod 600 "$CREDENTIAL_FILE"
|
|||||||
# Add Gitea credentials (adjust URL to match your Gitea instance)
|
# Add Gitea credentials (adjust URL to match your Gitea instance)
|
||||||
# Format: https://username:token@gitea.example.com
|
# Format: https://username:token@gitea.example.com
|
||||||
# Using the token as both username and password is common for API tokens
|
# Using the token as both username and password is common for API tokens
|
||||||
echo "https://$GITEA_ACCESS_TOKEN:$GITEA_ACCESS_TOKEN@gitea.nym.sh" >> "$CREDENTIAL_FILE"
|
echo "https://kennethnym:$GITEA_ACCESS_TOKEN@code.nym.sh" >> "$CREDENTIAL_FILE"
|
||||||
|
|
||||||
# Additional Git configurations for better experience
|
# Additional Git configurations for better experience
|
||||||
git config --global init.defaultBranch main
|
git config --global init.defaultBranch main
|
||||||
@@ -71,10 +71,20 @@ if [ -n "$GPG_PRIVATE_KEY" ]; then
|
|||||||
# Import the private key with passphrase if provided
|
# Import the private key with passphrase if provided
|
||||||
if [ -n "$GPG_PRIVATE_KEY_PASSPHRASE" ]; then
|
if [ -n "$GPG_PRIVATE_KEY_PASSPHRASE" ]; then
|
||||||
echo "Using provided passphrase for key import..."
|
echo "Using provided passphrase for key import..."
|
||||||
echo "$GPG_PRIVATE_KEY" | gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PRIVATE_KEY_PASSPHRASE" --import
|
# Create temporary file for the key
|
||||||
|
TEMP_KEY_FILE=$(mktemp)
|
||||||
|
echo -e "$GPG_PRIVATE_KEY" > "$TEMP_KEY_FILE"
|
||||||
|
chmod 600 "$TEMP_KEY_FILE"
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PRIVATE_KEY_PASSPHRASE" --import "$TEMP_KEY_FILE"
|
||||||
|
rm -f "$TEMP_KEY_FILE"
|
||||||
else
|
else
|
||||||
echo "No passphrase provided, importing key..."
|
echo "No passphrase provided, importing key..."
|
||||||
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
|
# Create temporary file for the key
|
||||||
|
TEMP_KEY_FILE=$(mktemp)
|
||||||
|
echo -e "$GPG_PRIVATE_KEY" > "$TEMP_KEY_FILE"
|
||||||
|
chmod 600 "$TEMP_KEY_FILE"
|
||||||
|
gpg --batch --import "$TEMP_KEY_FILE"
|
||||||
|
rm -f "$TEMP_KEY_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
Reference in New Issue
Block a user