Skip to content

Commit

Permalink
workflow: check if environment variables are not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ksauraj authored Jan 24, 2025
1 parent 91d4ca1 commit b6cb20b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,28 @@ jobs:
${{ runner.os }}-go-mod-
- name: Build for GitHub Actions
env:
PRIVATE_PGP_KEY_CONTENT: ${{ secrets.PRIVATE_PGP_KEY_CONTENT }}
PRIVATE_PGP_KEY_PASSPHRASE: ${{ secrets.PRIVATE_PGP_KEY_PASSPHRASE }}
run: |
set -e # Exit immediately if any command fails
# Check if environment variables are not empty
if [ -z "$PRIVATE_PGP_KEY_CONTENT" ]; then
echo "Error: PRIVATE_PGP_KEY_CONTENT is empty or not set."
exit 1
fi
if [ -z "$PRIVATE_PGP_KEY_PASSPHRASE" ]; then
echo "Error: PRIVATE_PGP_KEY_PASSPHRASE is empty or not set."
exit 1
fi
# Proceed with the build process
echo "$PRIVATE_PGP_KEY_CONTENT" > crypto/privkey.pem
echo "$PRIVATE_PGP_KEY_PASSPHRASE" > crypto/passphrase.txt
chmod 600 crypto/privkey.pem crypto/passphrase.txt # Restrict file permissions
make build_gh_actions
rm -f crypto/privkey.pem crypto/passphrase.txt # Clean up sensitive files
env:
PRIVATE_PGP_KEY_CONTENT: ${{ secrets.PRIVATE_PGP_KEY_CONTENT }}
PRIVATE_PGP_KEY_PASSPHRASE: ${{ secrets.PRIVATE_PGP_KEY_PASSPHRASE }}


- name: Get Version from Makefile
id: get_version
run: |
Expand Down

0 comments on commit b6cb20b

Please sign in to comment.