-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
43 lines (41 loc) · 1.78 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
name: Deploy Example Previews
on:
issue_comment:
types: [created]
jobs:
deploy_example_preview:
runs-on: ubuntu-latest
if: ${{ contains(github.event.comment.body, '/deploy') }}
steps:
- name: Set Example Name
id: set-example-name
run: echo "EXAMPLE_NAME=$(echo ${{ github.event.comment.body }} | cut -f 2 -d ' ')" >> $GITHUB_ENV
- 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 --ignore-scripts
- name: Build example
run: pnpm build --scope ${{ env.EXAMPLE_NAME }}
- name: test path
run: ls -l ${{ format('./examples/{0}/{1}', env.EXAMPLE_NAME, contains(fromJson('["finefoods-client"]'), env.EXAMPLE_NAME) && '.next' || 'dist') }}
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: ${{ format('./examples/{0}/{1}', env.EXAMPLE_NAME, contains(fromJson('["finefoods-client"]'), env.EXAMPLE_NAME) && '.next' || 'dist') }}
github-token: ${{ secrets.PANKOD_BOT_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
alias: deploy-preview-${{ env.EXAMPLE_NAME }}-${{ github.event.comment.node_id }}
enable-pull-request-comment: false
overwrites-pull-request-comment: false
github-deployment-environment: "deploy-preview-${{ env.EXAMPLE_NAME }}-${{ github.event.comment.node_id }}"
netlify-config-path: ./examples/${{ env.EXAMPLE_NAME }}/netlify.toml
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10