-
Notifications
You must be signed in to change notification settings - Fork 221
125 lines (119 loc) · 4.11 KB
/
production.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Production
on:
push:
tags:
- 'v*.*.*'
env:
ALGOLIA_ADMIN_KEY: ${{ secrets.PROD_CI_ALGOLIA_ADMIN_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.PROD_CI_AWS_ACCESS_KEY }}
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.PROD_CI_AWS_CLOUDFRONT_DISTRIBUTION_ID }}
AWS_REGION: 'eu-west-1'
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROD_CI_AWS_SECRET_KEY }}
BUCKET_NAME: ${{ secrets.PROD_CI_BUCKET_NAME }}
BUCKET_REGION: ${{ secrets.PROD_CI_BUCKET_REGION }}
GATSBY_ALGOLIA_APP_ID: ${{ secrets.PROD_CI_GATSBY_ALGOLIA_APP_ID }}
GATSBY_ALGOLIA_INDEX_NAME: ${{ secrets.PROD_CI_GATSBY_ALGOLIA_INDEX_NAME }}
GATSBY_ALGOLIA_SEARCH_ONLY_KEY: ${{ secrets.PROD_CI_GATSBY_ALGOLIA_SEARCH_ONLY_KEY }}
GATSBY_DEFAULT_APP_URL: https://app.${{ secrets.PROD_CI_MAIN_URL }}
GATSBY_DEFAULT_BLOG_URL: https://${{ secrets.PROD_CI_MAIN_URL }}/blog
GATSBY_DEFAULT_DOC_URL: https://${{ secrets.PROD_CI_MAIN_URL }}/docs
GATSBY_DEFAULT_MAIN_URL: https://${{ secrets.PROD_CI_MAIN_URL }}
GATSBY_GOOGLE_API_KEY: ${{ secrets.PROD_CI_GATSBY_GOOGLE_API_KEY }}
GATSBY_NEWSLETTER_FORM_URL: https://go2.grafana.com
GATSBY_NEWSLETTER_FORM_MUNCHKIN_ID: 356-YFG-389
GATSBY_NEWSLETTER_FORM_ID: 1420
jobs:
update-dependencies:
name: Update node module dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 16.xs
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
lint:
name: Lint code
runs-on: ubuntu-latest
needs:
- update-dependencies
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 16.xs
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Check formatting
run: |
npm run format
- name: Lint code
run: |
npm run lint
- name: Lint code examples
run: |
npm run lint:examples
lint-prose:
name: Lint prose
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: ./src/data/markdown
version: 2.17.0
fail_on_error: true
vale_flags: '--glob=**/{docs,translated-guides/en}/**/*.md'
build-deploy-prod:
name: Build and deploy to prod
runs-on: ubuntu-latest
needs:
- lint
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 16.xs
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build:gatsby
- name: Checks if AWS CLI already installed
run: (command -v aws >/dev/null && echo "is_aws_installed=true" || echo "is_aws_installed=false") >> $GITHUB_ENV
- name: Download AWS CLI
if: ${{ !env.is_aws_installed }}
run: curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && unzip awscliv2.zip
- name: Install AWS CLI
if: ${{ !env.is_aws_installed }}
run: sudo ./aws/install
- name: Confirm the installation
run: aws --version
- name: Deploy
run: npm run deploy