fix: 캐시가 존재해도 pnpm install 실행되도록 수정 (#64) #5
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: MAIN CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| Deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v3 | |
| - name: Install pnpm | |
| run: | | |
| npm install -g pnpm | |
| - name: Get pnpm store path | |
| id: pnpm-cache-path | |
| run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV | |
| - name: Cache pnpm modules | |
| id: cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm- | |
| ${{ runner.os }}- | |
| - name: Install Dependencies | |
| run: | | |
| pnpm install --frozen-lockfile | |
| pnpm store prune | |
| - name: Set up .env file | |
| run: | | |
| echo "VITE_API_URL=${{ secrets.VITE_API_URL_TEMP }}" > .env.production | |
| echo "HTTPS=true" >> .env.production | |
| - name: Build | |
| run: pnpm run build | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v2 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Deploy to S3 | |
| run: aws s3 sync ./dist s3://${{ secrets.AWS_BUCKET_NAME }} --delete | |
| - name: Invalidate CloudFront Cache | |
| run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*" |