-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.61 KB
/
Copy pathdeploy.yml
File metadata and controls
55 lines (46 loc) · 1.61 KB
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
name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
Deploy:
runs-on: ubuntu-latest
steps:
- uses: marocchino/sticky-pull-request-comment@v2
with:
message: "Version Preview URL: ⏳deployment is in progress..."
- uses: actions/checkout@v6
- uses: ./.github/actions/setup
- name: Restore build cache
uses: actions/cache@v4
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '!node_modules/**/*') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}-
${{ runner.os }}-nextjs-
- uses: nemolize/set-wrangler-name@v1
- run: npx opennextjs-cloudflare build
- id: deploy
name: Deploy
run: |
OUTPUT=$(npx opennextjs-cloudflare ${{ github.event_name == 'pull_request' && 'upload' || 'deploy' }})
echo "$OUTPUT"
echo "preview_line=$(echo "$OUTPUT" | grep "Version Preview URL:")" >> $GITHUB_OUTPUT
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Add preview URL comment
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
message: ${{ steps.deploy.outputs.preview_line }}