forked from apestel/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (92 loc) · 3.05 KB
/
publish-docs.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
105
106
107
108
109
110
name: Publish Docs If Updated
on:
pull_request:
types: [closed, synchronize, opened, reopened]
branches:
- master
jobs:
check-docs-diff:
runs-on: macos-latest
outputs:
diff: ${{ steps.git-diff.outputs.diff }}
steps:
- name: Checkout Vector
uses: actions/checkout@v2
- name: Check MD Diff
id: git-diff
uses: technote-space/get-diff-action@v3
with:
PREFIX_FILTER: |
docs
build:
runs-on: macos-latest
needs: check-docs-diff
if: ${{ needs.check-docs-diff.outputs.diff }}
steps:
- name: Clone Vector
uses: actions/checkout@v2
with:
repository: timberio/vector
ref: ${{ github.ref }}
path: vector
- name: Clone Vector Website
uses: actions/checkout@v2
with:
# timberio/vector-website and gatsby-docs respectively
repository: timberio/vector-website
ref: gatsby-docs
path: vector-website
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Setup Cue
run: brew install cuelang/tap/cue
- name: Setup Node
uses: actions/setup-node@v1
- name: Install Dependencies
working-directory: ./vector-website
run: |
npm config set '//registry.npmjs.org/:_authToken' "${{ secrets.NPM_TOKEN }}"
yarn install
cd ./plugins/gatsby-plugin-graphql-codegen && yarn install
- name: Build Site
run: cd ./vector-website && yarn run build
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: gatsby-build
path: ./vector-website/public
preview:
runs-on: macos-latest
needs: build
if: github.event.action != 'closed'
steps:
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: gatsby-build
- name: Setup Node
uses: actions/setup-node@v1
- name: Install Dependencies
run: npm install -g netlify-cli
- name: Deploy Preview
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: netlify deploy --dir=./ --message="Preview from vector:${{ github.head_ref }}@${{ github.sha }} With timberio/vector-website@gatsby-docs"
publish:
runs-on: macos-latest
needs: build
if: github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: gatsby-build
- name: Setup Node
uses: actions/setup-node@v1
- name: Install Dependencies
run: npm install -g netlify-cli
- name: Deploy Production
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: netlify deploy --dir=./ --prod --message="Deploy from vector:${{ github.head_ref }}@${{ github.sha }} With timberio/vector-website@gatsby-docs"