Tweaking some of the build to function pt2

Signed-off-by: nopeitsnothing <no@anonymousplanet.org>
This commit is contained in:
nopeitsnothing
2026-04-20 02:58:56 -04:00
parent df2dd61676
commit ae50911375
2 changed files with 44 additions and 44 deletions
+9 -9
View File
@@ -58,15 +58,15 @@ jobs:
CI: true CI: true
run: python scripts/build_guide_pdf.py --${{ inputs.build_mode || 'both' }} run: python scripts/build_guide_pdf.py --${{ inputs.build_mode || 'both' }}
- name: 🛡️ Sign PDFs # - name: 🛡️ Hash/Sign PDFs
env: # env:
GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }} # GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} # GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} # I'm just gonna do this locally because GPG signing in CI
run: | run: | # is a pain and I don't want to deal with it right now.
cd ${{ github.workspace }} # cd ${{ github.workspace }}
# Import GPG key # # Import GPG key
export GPG_TTY=$(tty) # export GPG_TTY=$(tty)
echo "$GPG_KEY" | gpg --batch --import 2>/dev/null || true # echo "$GPG_KEY" | gpg --batch --import 2>/dev/null || true
chmod +x scripts/sign-pdfs.sh chmod +x scripts/sign-pdfs.sh
./scripts/sign-pdfs.sh ./scripts/sign-pdfs.sh
+35 -35
View File
@@ -43,30 +43,30 @@ check_dependencies() {
done done
# Check GPG key availability # Check GPG key availability
if [ -z "$GPG_KEY_ID" ]; then # if [ -z "$GPG_KEY_ID" ]; then
GPG_KEY_ID="${SIGN_PDF_GPG_KEY:-}" # GPG_KEY_ID="${SIGN_PDF_GPG_KEY:-}"
fi # fi
if [ -n "$GPG_KEY_ID" ]; then # if [ -n "$GPG_KEY_ID" ]; then
if ! gpg --list-keys "$GPG_KEY_ID" &> /dev/null; then # if ! gpg --list-keys "$GPG_KEY_ID" &> /dev/null; then
print_error "GPG key '$GPG_KEY_ID' not found in your keyring." # print_error "GPG key '$GPG_KEY_ID' not found in your keyring."
exit 1 # exit 1
fi # fi
else # else
# List available keys and prompt user # # List available keys and prompt user
print_warn "No GPG key ID specified. Listing available secret keys:" # print_warn "No GPG key ID specified. Listing available secret keys:"
gpg --list-secret-keys --keyid-format LONG # gpg --list-secret-keys --keyid-format LONG
read -p "Enter the GPG key ID to use for signing (or press Enter to skip): " GPG_KEY_ID # read -p "Enter the GPG key ID to use for signing (or press Enter to skip): " GPG_KEY_ID
if [ -n "$GPG_KEY_ID" ]; then # if [ -n "$GPG_KEY_ID" ]; then
if ! gpg --list-keys "$GPG_KEY_ID" &> /dev/null; then # if ! gpg --list-keys "$GPG_KEY_ID" &> /dev/null; then
print_error "GPG key '$GPG_KEY_ID' not found in your keyring." # print_error "GPG key '$GPG_KEY_ID' not found in your keyring."
exit 1 # exit 1
fi # fi
else # else
print_warn "No GPG signing will be performed. Set SIGN_PDF_GPG_KEY environment variable or pass key ID as argument." # print_warn "No GPG signing will be performed. Set SIGN_PDF_GPG_KEY environment variable or pass key ID as argument."
fi # fi
fi # fi
print_info "All dependencies checked successfully!" print_info "All dependencies checked successfully!"
} }
@@ -109,21 +109,21 @@ generate_b2sum() {
} }
# GPG sign a file # GPG sign a file
gpg_sign() { # gpg_sign() {
local file="$1" # local file="$1"
local filename=$(basename "$file") # local filename=$(basename "$file")
if [ -z "$GPG_KEY_ID" ]; then # if [ -z "$GPG_KEY_ID" ]; then
print_warn "Skipping GPG signing for '$filename' (no key ID provided)" # print_warn "Skipping GPG signing for '$filename' (no key ID provided)"
return 0 # return 0
fi # fi
# Sign the file in detached mode with ASCII armor # # Sign the file in detached mode with ASCII armor
gpg --batch --yes --detach-sign --armor --local-user "$GPG_KEY_ID" \ # gpg --batch --yes --detach-sign --armor --local-user "$GPG_KEY_ID" \
--output "${file}.sig" "$file" # --output "${file}.sig" "$file"
print_info "GPG signature generated: ${file}.sig" # print_info "GPG signature generated: ${file}.sig"
} # }
# Process a single PDF file # Process a single PDF file
process_pdf() { process_pdf() {
@@ -137,7 +137,7 @@ process_pdf() {
generate_b2sum "$pdf_file" generate_b2sum "$pdf_file"
# GPG sign if key is available # GPG sign if key is available
gpg_sign "$pdf_file" # gpg_sign "$pdf_file"
} }
# Main function # Main function