Merge pull request #16 from WebCreatorX/feature/sidebar #18
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 EC2 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| - dev | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js and Cache | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22" | |
| # npm install 속도 향상을 위한 캐시 (Optional) | |
| cache: "pnpm" | |
| - name: Install Dependencies & Build Project | |
| run: | | |
| pnpm install --frozen-lockfile | |
| cd apps/editor | |
| touch .env | |
| echo NEXT_PUBLIC_SUPABASE_URL=${{secrets.NEXT_PUBLIC_SUPABASE_URL}} >> .env | |
| echo NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY=${{secrets.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY}} >> .env | |
| echo SUPABASE_DATABASE_PASSWORD=${{secrets.SUPABASE_DATABASE_PASSWORD}} >> .env | |
| cd ../.. | |
| pnpm turbo run build --filter=editor | |
| # 🚨 핵심: 배포 패키지 만들기 (Standalone 활용) | |
| - name: Create Deploy Artifact | |
| run: | | |
| mkdir deploy_package | |
| cp -r apps/editor/.next/standalone/* deploy_package/ | |
| mkdir -p deploy_package/.next/static | |
| mkdir -p deploy_package/public | |
| cp -r apps/editor/.next/static/* deploy_package/.next/static/ | |
| if [ -d apps/editor/public ]; then | |
| cp -r apps/editor/public/* deploy_package/public/ | |
| fi | |
| cp apps/editor/appspec.yml deploy_package/ | |
| cp -r apps/editor/scripts deploy_package/scripts | |
| cp apps/editor/.env deploy_package/ | |
| cd deploy_package | |
| zip -r ../artifact.zip . | |
| - name: AWS configure credentials | |
| uses: aws-actions/configure-aws-credentials@v5 | |
| 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: upload to S3 | |
| run: aws s3 cp --region ap-northeast-2 ./artifact.zip s3://webcreator-deploy-bucket/deploy/ | |
| - name: deploy with AWS codeDeploy | |
| run: aws deploy create-deployment | |
| --application-name webCreator-code-deploy | |
| --deployment-config-name CodeDeployDefault.OneAtATime | |
| --deployment-group-name GROUP | |
| --s3-location bucket=webcreator-deploy-bucket,bundleType=zip,key=deploy/artifact.zip |