Merge pull request #9 from center-for-threat-informed-defense/attack16 #28
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 | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build_website: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install Poetry | |
run: curl -sSL https://install.python-poetry.org/ | python - | |
- name: Add Poetry to PATH | |
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: poetry install | |
- name: Run Black | |
run: poetry run black --check src/ | |
- name: Run Isort | |
run: poetry run isort --check src/ | |
- name: Download ATT&CK data | |
run: poetry run download_attack_stix --stix20 --all -d data/attack | |
- name: Build website | |
env: | |
LOGURU_LEVEL: INFO | |
run: poetry run build-attack-sync --url-prefix "/attack-sync" --google-analytics "G-XZLBW4KBV1" | |
- name: Upload website artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: attack_sync_html | |
path: public/ | |
github_pages: | |
# This job only runs when committing or merging to main branch. | |
if: github.ref_name == 'main' | |
needs: build_website | |
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 website build | |
uses: actions/download-artifact@v3 | |
with: | |
name: attack_sync_html | |
path: public/ | |
- name: Upload website to GitHub pages | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./public | |
- name: Deploy GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |