-
Notifications
You must be signed in to change notification settings - Fork 8
96 lines (96 loc) · 3.8 KB
/
preview_on_pr.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
name: preview-on-pr
on:
- pull_request
- merge_group
jobs:
yaml-validation:
strategy:
matrix:
values:
- name: 'Meta-Main Validation'
schema: 'schemas/meta-main.yml'
target: 'meta/main'
- name: 'Meta-Category Validation'
schema: 'schemas/meta-category.yml'
target: 'meta/category'
- name: 'People Validation'
schema: 'schemas/people.yml'
target: 'about/people.yml'
- name: 'Banners Frontmatter Validation'
schema: 'schemas/banners-frontmatter.yml'
target: 'banners/announcements'
- name: 'Help Validation'
schema: 'schemas/meta-category.yml'
target: 'help'
- name: 'Collaboration Validation'
schema: 'schemas/collaborations.yml'
target: 'our-work/collaborations'
- name: 'Software Validation'
schema: 'schemas/software.yml'
target: 'our-work/software'
- name: 'Workshops Validation'
schema: 'schemas/workshops-and-talks.yml'
target: 'our-work/workshops-and-talks'
- name: 'Services Frontmatter Validation'
schema: 'schemas/services-frontmatter.yml'
target: 'services'
- name: 'About Frontmatter Validation'
schema: 'schemas/about-frontmatter.yml'
target: 'temp'
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Services frontmatter to yml
if: startsWith(matrix.values.name, 'Services')
run: |
grep '^---$' services/**/*.md |cut -f 1 -d ":" | uniq | xargs -I fname sh -c 'grep -A 100 "^---$" fname | grep -B 100 "^---$" | grep -v "\-\-\-" | grep -v "\-\-"> fname.yml'
- name: Banners frontmatter to yml
if: startsWith(matrix.values.name, 'Banners')
run: |
grep '^---$' services/**/*.md |cut -f 1 -d ":" | uniq | xargs -I fname sh -c 'grep -A 100 "^---$" fname | grep -B 100 "^---$" | grep -v "\-\-\-" | grep -v "\-\-"> fname.yml'
- name: About frontmatter to yml
if: startsWith(matrix.values.name, 'About')
run: |
mkdir -p temp/about
grep '^---$' about/*.md |cut -f 1 -d ":" | uniq | xargs -I fname sh -c 'grep -A 100 "^---$" fname | grep -B 100 "^---$" | grep -v "\-\-\-" | grep -v "\-\-"> temp/fname.yml'
- name: Check if directory is empty
run: |
if [ "$(ls -A {{ matrix.values.target }})" ]; then
echo "Directory is not empty, proceeding with next step"
fi
- name: ${{ matrix.values.name }}
uses: nrkno/yaml-schema-validator-github-action@v4
if: ${{ success() }}
with:
schema: ${{ matrix.values.schema }}
target: ${{ matrix.values.target }}
build_and_preview:
runs-on: ubuntu-latest
needs: [yaml-validation]
steps:
- uses: actions/setup-node@v3
with:
node-version: '16'
- uses: actions/checkout@v3
with:
repository: brown-ccv/ccv-website-nuxt
submodules: recursive
fetch-depth: 0
- name: Change content to current commit
run: cd content && git checkout ${{ github.event.pull_request.head.sha }}
- name: Install
run: npm ci
- name: Generate Static Content
run: |
export NODE_OPTIONS="--max_old_space_size=4096"
npm run generate
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_CCV_BROWN_EDU }}'
firebaseToolsVersion: 9.12.1 # Pin firebase tools versions to same as ccv-website-nuxt
projectId: ccv-brown-edu
expires: 7d
env:
FIREBASE_CLI_PREVIEWS: hostingchannels