Merge pull request #32 from center-for-threat-informed-defense/TAT-15… #120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Website | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
# If another web build starts for the same branch, cancel the previous build. This | |
# protects us from two builds trying to upload at the same time and clobbering each | |
# other. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
id-token: write | |
pages: write | |
pull-requests: write | |
jobs: | |
tat_website_build: | |
runs-on: ubuntu-latest | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
steps: | |
# Configure Environment | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
id: "setup-node" | |
with: | |
node-version: '19' | |
cache: 'npm' | |
cache-dependency-path: './package-lock.json' | |
- name: Install dependencies | |
run: npm ci | |
# Lint | |
- name: Lint | |
run: npm run lint | |
# Build and Upload Artifact | |
- name: Type Check | |
run: npm run type-check | |
- name: Build | |
run: npm run build-only -- --base / | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tat_website | |
path: ./dist/ | |
github_pages: | |
# This job only runs when committing or merging to main branch. | |
if: github.ref_name == 'main' | |
needs: tat_website_build | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: $\{\{ steps.deployment.outputs.page_url \}\} | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Download Web Site | |
uses: actions/download-artifact@v3 | |
with: | |
name: tat_website | |
path: tat_website | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./tat_website | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |