-
Notifications
You must be signed in to change notification settings - Fork 35
70 lines (63 loc) · 2.16 KB
/
draft-deploy.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
67
68
69
70
name: Netlify Draft Deploy
on:
workflow_dispatch:
pull_request:
jobs:
deploy:
if: ${{ github.event.pull_request.base.repo.clone_url == github.event.pull_request.head.repo.clone_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
# https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: 9
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store
restore-keys: |
${{ runner.os }}-pnpm-store
- name: Install
run: pnpm i --no-frozen-lockfile --no-verify-store-integrity
- name: Build
run: pnpm --filter @public-ui/sample-react... build
- name: Netlify Deploy
uses: netlify/actions/cli@master
id: netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ vars.NETLIFY_SITE_ID }}
with:
args: deploy --filter=@public-ui/sample-react
- name: Find comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Netlify Draft Deployment
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Netlify Draft Deployment
URL: ${{ steps.netlify.outputs.NETLIFY_URL }}
Logs: ${{ steps.netlify.outputs.NETLIFY_LOGS_URL }}
edit-mode: replace