설문, 캠페인 페이지 수정 #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to AWS Elastic Beanstalk | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| on: | |
| pull_request: | |
| types: [ opened, reopened, synchronize ] | |
| push: | |
| branches: | |
| - "main" | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build project | |
| run: npm run build | |
| - name: Install AWS CLI | |
| run: | | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| unzip awscliv2.zip | |
| sudo ./aws/install --update | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ap-northeast-2 | |
| - name: Generate deployment package | |
| run: | | |
| mkdir -p deploy | |
| cp -r dist deploy/ # dist 디렉토리를 포함 | |
| cp package.json deploy/ | |
| cp server.js deploy/ | |
| cp Procfile deploy/Procfile | |
| cd deploy && zip -r deploy.zip . | |
| - name: Beanstalk Deploy | |
| uses: einaregilsson/beanstalk-deploy@v22 | |
| with: | |
| aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| application_name: devoops-v | |
| environment_name: Devoops-v-env | |
| version_label: github-action-${{ github.sha }} | |
| region: ap-northeast-2 | |
| deployment_package: deploy/deploy.zip |