-
Notifications
You must be signed in to change notification settings - Fork 216
100 lines (87 loc) · 3.14 KB
/
netlify-deploy-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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: trigger Netlify deploy preview
on:
pull_request:
paths: ['sites/docs/**', 'sites/main-site/**']
jobs:
change-detection:
name: 'detect changed sub-sites'
runs-on: ubuntu-latest
steps:
- name: Checkout website repo
uses: actions/checkout@v4
- name: Check changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v44
with:
files_yaml: |
docs:
- sites/docs/**
main-site:
- sites/main-site/**
outputs:
main-site_any_changed: ${{ steps.changed-files-yaml.outputs.main-site_any_changed }}
docs_any_changed: ${{ steps.changed-files-yaml.outputs.docs_any_changed }}
deploy-main-site:
name: 'Deploy preview for main-site'
runs-on: ubuntu-latest
needs: change-detection
if: github.repository == 'nf-core/website' && needs.change-detection.outputs.main-site_any_changed == 'true'
permissions:
pull-requests: write
steps:
- name: Checkout website repo
uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install npm deps
run: npm ci
- name: Build website
run: npm run build --workspace sites/main-site
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: './sites/main-site/dist'
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'nf-core/main-site PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}'
alias: nf-core-main-site-pr-${{ github.event.pull_request.number }}
enable-commit-comment: false
enable-commit-status: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_MAIN_SITE_ID }}
timeout-minutes: 1
deploy-docs:
name: 'Deploy preview for docs'
runs-on: ubuntu-latest
needs: change-detection
if: github.repository == 'nf-core/website' && needs.change-detection.outputs.docs_any_changed == 'true'
permissions:
pull-requests: write
steps:
- name: Checkout website repo
uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install npm deps
run: npm ci
- name: Build website
run: npm run build --workspace sites/docs
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: './sites/docs/dist'
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: 'nf-core/docs PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}'
alias: nf-core-docs-pr-${{ github.event.pull_request.number }}
enable-commit-comment: false
enable-commit-status: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DOCS_ID }}
timeout-minutes: 1