Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ set -o pipefail # Exit if any command in a pipeline fails

# Function to fetch a parameter and exit if it's empty
fetch_parameter() {
local value
# Add the --region flag to the aws command
value=$(aws ssm get-parameter --name "$1" --with-decryption --query 'Parameter.Value' --output text --region "${AWS_REGION}" | tr -d '\r\n')
if [ -z "$value" ]; then
echo "Error: SSM Parameter $1 is empty or could not be fetched." >&2
exit 1
fi
echo "$value"
}
local value
local region="${AWS_REGION:-eu-north-1}"
value=$(aws ssm get-parameter --name "$1" --with-decryption --query 'Parameter.Value' --output text --region "$region" | tr -d '\r\n')
if [ -z "$value" ]; then
echo "Error: SSM Parameter $1 is empty or could not be fetched." >&2
exit 1
fi
echo "$value"
}

# Fetch secrets from AWS SSM Parameter Store
APP_BASE_URL=$(fetch_parameter "/unraveldocs/APP_BASE_URL")
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ jobs:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_SSH_KEY }}
env:
envs:
AWS_REGION: ${{ env.AWS_REGION }}
script: |
export AWS_REGION=${{ env.AWS_REGION }}
# The EC2 instance role will be used for AWS commands
# Log in to ECR using the instance role
aws ecr get-login-password --region ${{ env.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_REGISTRY }}
Expand Down
Loading