-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
72 lines (70 loc) · 2.15 KB
/
example-previews.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
71
72
name: Deploy Example Previews
on:
pull_request:
branches:
- master
workflow_dispatch:
inputs:
example:
description: "Example name to deploy preview"
type: choice
required: true
options:
- finefoods-antd
- finefoods-mui
- app-crm
- pixels
- invoicer
jobs:
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
examples: ${{ inputs.example || steps.filter.outputs.changes }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
'finefoods-antd': 'examples/finefoods-antd/**'
'finefoods-mui': 'examples/finefoods-mui/**'
'app-crm': 'examples/app-crm/**'
'pixels': 'examples/pixels/**'
'invoicer': 'examples/invoicer/**'
preview:
runs-on: ubuntu-latest
needs: changes
strategy:
matrix:
example: ${{ fromJSON(needs.changes.outputs.examples) }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- name: Install Dependencies
run: |
pnpm install
pnpm build --scope ${{ matrix.example }}
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: "./examples/${{ matrix.example }}/dist"
github-token: ${{ secrets.PANKOD_BOT_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
alias: deploy-preview-${{ matrix.example }}-${{ github.event.number }}
enable-pull-request-comment: false
overwrites-pull-request-comment: false
github-deployment-environment: "deploy-preview-${{ matrix.example }}-${{ github.event.number }}"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10