Skip to content

Commit 37df543

Browse files
author
Ubuntu
committed
Update deploy.yml with AWS Secrets Manager integration
1 parent bbfc787 commit 37df543

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,26 @@ jobs:
1212
- name: Checkout code
1313
uses: actions/checkout@v4
1414

15+
- name: Configure AWS credentials
16+
uses: aws-actions/configure-aws-credentials@v3
17+
with:
18+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
19+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
20+
aws-region: us-east-1
21+
22+
- name: Get SonarQube secrets from AWS Secrets Manager
23+
id: secrets
24+
run: |
25+
sudo apt update && sudo apt install -y jq awscli
26+
SECRET_JSON=$(aws secretsmanager get-secret-value --secret-id sonarqube/credentials --query SecretString --output text)
27+
echo "SONAR_TOKEN=$(echo $SECRET_JSON | jq -r .SONAR_TOKEN)" >> $GITHUB_ENV
28+
echo "SONAR_HOST_URL=$(echo $SECRET_JSON | jq -r .SONAR_HOST_URL)" >> $GITHUB_ENV
29+
1530
- name: SonarQube scan
1631
uses: sonarsource/sonarqube-scan-action@master
1732
env:
18-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
19-
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
33+
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
34+
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL }}
2035

2136
- name: Copy files to local app directory
2237
run: |
@@ -27,4 +42,3 @@ jobs:
2742
run: |
2843
chmod +x ~/app/start.sh
2944
~/app/start.sh
30-

0 commit comments

Comments
 (0)