diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5a0f654..04f277e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,6 +14,12 @@ jobs: - name: Checkout source code uses: actions/checkout@v2 + - name: Set up Git credentials + run: echo "https://${{ secrets.GH_USERNAME }}:${{ secrets.GH_PAT }}@github.com" > ~/.git-credentials + + - name: Configure Git to use credentials from file + run: git config --global credential.helper store + # 파일 및 폴더를 압축하여 server.zip으로 저장 - name: Zip distributions run: zip -r server.zip . diff --git a/scripts/initialize.sh b/scripts/initialize.sh index 2b37608..92e843a 100644 --- a/scripts/initialize.sh +++ b/scripts/initialize.sh @@ -1,2 +1,11 @@ +# Parameter Store에서 GitHub 자격 증명을 가져오기 +GH_USERNAME=$(aws ssm get-parameter --name "/github/username" --with-decryption --query "Parameter.Value" --output text) +GH_PAT=$(aws ssm get-parameter --name "/github/token" --with-decryption --query "Parameter.Value" --output text) + +# GitHub 자격 증명 파일 설정 +echo "https://${GH_USERNAME}:${GH_PAT}@github.com" > ~/.git-credentials +git config --global credential.helper store + + cd /home/ubuntu/Server git pull origin master \ No newline at end of file