Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEPLOY] Github Action 기반의 정적 배포 Workflow 추가 #25

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
57 changes: 57 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 8potatoes-client-production

on:
push:
branches:
- main

env:
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }},
AWS_REGION: ${{ secrets.AWS_REGION }}

jobs:
build-project:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Environment Variable Setting
run: |
echo "VITE_TMAP_APP_KEY=${{ secrets.TMAP_APP_KEY }}" >> .env
echo "VITE_SERVER_URL=${{ secrets.SERVER_URL }}" >> .env
echo "VITE_X_NCP_APIGW_API_KEY_ID=${{ secrets.X_NCP_APIGW_API_KEY_ID }}" >> .env
echo "VITE_X_NCP_APIGW_API_KEY=${{ secrets.X_NCP_APIGW_API_KEY }}" >> .env
echo "VITE_ASSET_URL=${{ secrets.ASSET_URL }}" >> .env

- name: Build vite app
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_ID }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Upload Build File to S3
run: aws s3 sync --region $AWS_REGION dist s3://$S3_BUCKET_NAME --delete

- name: Invalidate CloudFront Cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"
94 changes: 41 additions & 53 deletions src/pages/rest-area-map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ export const RestAreaMapPage = () => {
const { origin, destination } = location.state;

const {
data: {
journeyPathList = [],
highways = {},
} = {},
data: { journeyPathList = [], highways = {} } = {},
isSuccess: isValidJourney,
} = useGetDestinationPath({
startX: origin.lon,
Expand Down Expand Up @@ -60,58 +57,49 @@ export const RestAreaMapPage = () => {
: new naverMaps.LatLng(destination.lat, destination.lon);

return (
<>
<NaverMapContainer style={{ height: '100dvh' }}>
<DestinationIndicator
start={origin.addressName}
end={destination.addressName}
<NaverMapContainer style={{ height: '100dvh' }}>
<DestinationIndicator
start={origin.addressName}
end={destination.addressName}
/>
{isValidHighwayRestArea && (
<RestAreaListDrawer
totalRestAreaCount={restAreaData.totalReststopCount}
restAreaList={restAreaData.reststops}
/>
{isValidHighwayRestArea && (
<RestAreaListDrawer
totalRestAreaCount={restAreaData.totalReststopCount}
restAreaList={restAreaData.reststops}
/>
)}
<NaverMap maxBounds={mapBound}>
{isValidJourney && (
<>
<Polyline
path={journeyPathList}
strokeColor={theme.color.main[100]}
strokeLineJoin="round"
strokeWeight={6}
strokeStyle="solid"
clickable={false}
/>
<DestinationMarker isStart position={startPosition} />
<DestinationMarker position={endPosition} />
</>
)}
<NaverMap maxBounds={mapBound}>
{isValidJourney && (
<>
<Polyline
path={journeyPathList}
strokeColor={theme.color.main[100]}
strokeLineJoin="round"
strokeWeight={6}
strokeStyle="solid"
clickable={false}
{isValidHighwayRestArea &&
restAreaData.reststops.map(
({ name, location, isRecommend }) => (
<RestAreaBubbleMarker
direction={'부산'}
restAreaName={name}
isRecommend={isRecommend}
position={
new naver.maps.LatLng(
location.latitude,
location.longitude,
)
}
/>
<DestinationMarker
isStart
position={startPosition}
/>
<DestinationMarker position={endPosition} />
</>
),
)}
{isValidHighwayRestArea &&
restAreaData.reststops.map(
({
name,
location,
isRecommend,
}) => (
<RestAreaBubbleMarker
direction={'부산'}
restAreaName={name}
isRecommend={isRecommend}
position={
new naver.maps.LatLng(
location.latitude,
location.longitude,
)
}
/>
),
)}
</NaverMap>
</NaverMapContainer>
</>
</NaverMap>
</NaverMapContainer>
);
};
Loading