Skip to content

feat: 2023

feat: 2023 #686

Workflow file for this run

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