feat: 유실물 페이지 (앱) #58
Workflow file for this run
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: Build & Deploy Ahhachul App | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'services/ahhachul.com/**' | |
| env: | |
| DEFAULT_NODE_VERSION: '20.14.0' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Parse secrets from JSON | |
| id: secrets | |
| run: | | |
| echo '${{ secrets.DEV_META_DATA }}' | jq -r 'to_entries | .[] | "echo \(.key)=\(.value) >> $GITHUB_ENV"' | bash | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ env.DEFAULT_NODE_VERSION }} | |
| - name: Install dependencies | |
| uses: ./.github/actions/yarn-install | |
| - name: Create .env file for ahhachul.com | |
| run: | | |
| echo '${{ secrets.DEV_REACT_APP_CONFIG }}' > config.json | |
| cat config.json | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> services/ahhachul.com/.env | |
| - name: Build ahhachul.com | |
| run: yarn build:app | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v2 | |
| with: | |
| aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Remove Existing Files & Upload New to S3 | |
| run: | | |
| aws s3 rm s3://${S3_BUCKET_NAME} --recursive | |
| aws s3 cp services/ahhachul.com/build s3://${S3_BUCKET_NAME} --recursive | |
| - name: Invalidate CloudFront | |
| run: aws cloudfront create-invalidation --distribution-id ${{ env.AWS_CLOUDFRONT_DISTRIBUTION_ID_USER }} --paths "/*" |