This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
116 lines (109 loc) · 3.36 KB
/
ci-cd.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
---
name: CI and CD
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Test scenario tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: true
push:
branches: ['main', 'terra-application-v1']
pull_request:
branches: ['main', 'terra-application-v1']
schedule:
- cron: '0 1 * * SUN'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Project
uses: ./.github/actions/setup
- if: github.event_name == 'pull_request'
name: Danger
uses: danger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/danger/danger-js/issues/557#issuecomment-664851950
DANGER_DISABLE_TRANSPILATION: true
- name: Linting Project
run: |
npm run lint
- name: Testing Project
run: |
npm run jest
wdio:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
theme: [default, lowlight, fusion]
steps:
- name: Checkout Project
uses: actions/checkout@v3
- name: Setup Project
uses: ./.github/actions/setup
- name: Compile Project Default
run: |
npm run compile:prod -- --output-path build/default
if: matrix.theme == 'default'
- name: Compile Project Lowlight
run: |
npm run compile:lowlight -- --output-path build/lowlight
if: matrix.theme == 'lowlight'
- name: Compile Project Fusion
run: |
npm run compile:fusion -- --output-path build/fusion
if: matrix.theme == 'fusion'
- name: Run WDIO Tests for theme ${{ matrix.theme }}
env:
SITE: build/${{ matrix.theme }}
run: npm run wdio:${{ matrix.theme }}
release-and-deploy:
runs-on: ubuntu-latest
needs: [build, wdio]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Setup GitHub Config
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Setup Project
uses: ./.github/actions/setup
- name: Build
env:
TERRA_DEV_SITE_NEW_RELIC_LICENSE_KEY: ${{ secrets.TERRA_DEV_SITE_NEW_RELIC_LICENSE_KEY }}
TERRA_DEV_SITE_NEW_RELIC_APPLICATION_ID: "141260567"
TERRA_DEV_SITE_PUBLIC_PATH: /terra-application/
run: npm run compile:prod
- name: Release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx terra release
# - name: Deploy
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./build
# keep_files: true
# user_name: 'github-actions[bot]'
# user_email: 'github-actions[bot]@users.noreply.github.com'
# commit_message: 'chore(docs): Regenerate docs'