-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (57 loc) · 2.13 KB
/
preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Cloudflare Pages Preview
# Preview - main, develop PR open 시
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches: [main, develop]
env:
CI: false
permissions:
contents: read
deployments: write
pull-requests: write
jobs:
publish:
runs-on: ubuntu-latest
name: Publish to Cloudflare Pages
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate Env File
run: |
echo "VITE_KAKAO_REST_API=$VITE_KAKAO_REST_API" >> .env
echo "VITE_APP_BASE_URL=$VITE_APP_BASE_URL" >> .env
echo "VITE_APP_FAST_URL=$VITE_APP_FAST_URL" >> .env
echo "VITE_APP_GPT_URL=$VITE_APP_GPT_URL" >> .env
env:
VITE_KAKAO_REST_API: ${{secrets.VITE_KAKAO_REST_API}}
VITE_APP_BASE_URL: ${{secrets.VITE_APP_BASE_URL}}
VITE_APP_FAST_URL: ${{secrets.VITE_APP_FAST_URL}}
VITE_APP_GPT_URL: ${{secrets.VITE_APP_GPT_URL}}
- name: Build
run: yarn install && yarn build
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
id: cloudflare
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: sodong
directory: dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
- name: Comment PR
uses: mshick/add-pr-comment@v2
with:
message-id: cloudflare-preview
message: |
### 👀 Preview Success!
| Name | Link |
|---------------------------------|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | ${{ github.sha }} |
|<span aria-hidden="true">🔍</span> Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
|<span aria-hidden="true">🖇️</span> Deploy Preview Url | [${{ steps.cloudflare.outputs.url }}](${{ steps.cloudflare.outputs.url }}) |
|<span aria-hidden="true">🌳</span> Environment | ${{ steps.cloudflare.outputs.environment }} |
---