-
Notifications
You must be signed in to change notification settings - Fork 7
104 lines (91 loc) · 3.4 KB
/
docs-workflow.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
101
102
103
104
name: Design System Docs
on:
pull_request:
types:
# Trigger when the pull request is labelled.
# Used to only deploy previews when the "docs preview" label is added.
- labeled
# Trigger when an existing PR is updated.
# Used to make sure new previews are deployed for changes after the label is added.
- synchronize
release:
types:
- created
jobs:
# This job will:
# * deploy a draft every time there is a pull request created that has the expected label
# * comment on that pull request with the deploy URL
deployPRDraft:
name: Deploy draft to Netlify
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]' && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'docs preview')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
# We link the @citizensadvice/design-system package
# from the root but we only build the lib/ directory
# when we publish to npm, so we need to build it first.
- uses: bahmutov/npm-install@v1
- run: npm run build
# Setup docs site
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
bundler-cache: true
working-directory: design-system-docs
# Install dependencies
- uses: bahmutov/npm-install@v1
with:
working-directory: design-system-docs
- run: ./bin/bridgetown deploy
working-directory: design-system-docs
- name: Deploy draft to Netlify
uses: South-Paw/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
build-dir: ./design-system-docs/output
draft: true
comment-on-pull-request: true
config-path: ./netlify.toml
# This job will:
# * deploy a production build every time there is a release created
# * comment that commit with the deploy URL
publishOnRelease:
name: Publish release to Netlify
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
# We link the @citizensadvice/design-system package
# from the root but we only build the lib/ directory
# when we publish to npm, so we need to build it first.
- uses: bahmutov/npm-install@v1
- run: npm run build
# Setup docs site
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.5'
bundler-cache: true
working-directory: design-system-docs
# Install dependencies
- uses: bahmutov/npm-install@v1
with:
working-directory: design-system-docs
- run: ./bin/bridgetown deploy
working-directory: design-system-docs
- name: Deploy production to Netlify
uses: South-Paw/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
build-dir: ./design-system-docs/output
config-path: ./netlify.toml
comment-on-commit: true