Skip to content

Commit

Permalink
Prepare for publication
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecarenzo committed Aug 13, 2024
1 parent 2266e43 commit fca33e1
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 74 deletions.
145 changes: 72 additions & 73 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,79 +42,78 @@ jobs:
path: docs/_build/dirhtml/

# Delete this job before public release and clear GitHub secrets:
azure_blob:
needs: docs
runs-on: ubuntu-latest
env:
AZURE_STORAGE_ACCOUNT: defendingotwithattack
AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_SAS_TOKEN }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
STATICRYPT_PASS: ${{ secrets.STATICRYPT_PASS }}
NODE_OPTIONS: --max-old-space-size=8192
steps:
- uses: actions/setup-node@v3
with:
node-version: '19'
- run: npm install -g staticrypt
- name: Download HTML docs
uses: actions/download-artifact@v3
with:
name: defending-ot-with-attack-docs-html
path: docs
- run: >
staticrypt --remember 30 --salt fef766352a7b428f8afe52e9d9f53e61 \
--password $STATICRYPT_PASS --short \
--template-title "Defending OT with ATT&CK (branch: $BRANCH_NAME)" \
--template-instructions "The contents of this site are marked TLP:AMBER:CTID-R&D:23-92. Do not share with unauthorized individuals." \
--template-color-primary "#6241c5" \
--template-color-secondary "#b2b2b2" \
--template-button "Log In" \
-r docs/
- name: Ensure StatiCrypt ran # StatiCrypt will fail without warning; verify it created a directory
run: test -d encrypted
- name: Copy encrypted HTML files
run: rsync -Ir -v --include='*.html' --exclude='*.*' encrypted/docs .
- name: Set the branch name
run: mv docs "$BRANCH_NAME"
- name: Install Azure CLI
run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Delete old blobs
run: az storage blob delete-batch -s '$web' --pattern "$BRANCH_NAME/*"
- name: Upload to blob storage
run: az storage blob upload-batch -s . --pattern "$BRANCH_NAME/*" -d '$web'
- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `This PR has been published to https://${process.env['AZURE_STORAGE_ACCOUNT']}.z13.web.core.windows.net/${process.env['BRANCH_NAME']}/`,
})
# # TODO Uncomment before publishing repository.
# github_pages:
# # This job only runs when committing or merging to main branch.
# if: github.ref_name == 'main'
# azure_blob:
# needs: docs
# runs-on: ubuntu-latest
# environment:
# name: github-pages
# url: $\{\{ steps.deployment.outputs.page_url \}\}

# env:
# AZURE_STORAGE_ACCOUNT: defendingotwithattack
# AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_SAS_TOKEN }}
# BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# STATICRYPT_PASS: ${{ secrets.STATICRYPT_PASS }}
# NODE_OPTIONS: --max-old-space-size=8192
# steps:
# - name: Setup Pages
# uses: actions/configure-pages@v2
# - name: Download HTML docs
# uses: actions/download-artifact@v3
# with:
# name: defending-ot-with-attack-docs-html
# path: docs
# - name: Upload artifact
# uses: actions/upload-pages-artifact@v1
# with:
# path: ./docs
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v1
# - uses: actions/setup-node@v3
# with:
# node-version: '19'
# - run: npm install -g staticrypt
# - name: Download HTML docs
# uses: actions/download-artifact@v3
# with:
# name: defending-ot-with-attack-docs-html
# path: docs
# - run: >
# staticrypt --remember 30 --salt fef766352a7b428f8afe52e9d9f53e61 \
# --password $STATICRYPT_PASS --short \
# --template-title "Defending OT with ATT&CK (branch: $BRANCH_NAME)" \
# --template-instructions "The contents of this site are marked TLP:AMBER:CTID-R&D:23-92. Do not share with unauthorized individuals." \
# --template-color-primary "#6241c5" \
# --template-color-secondary "#b2b2b2" \
# --template-button "Log In" \
# -r docs/
# - name: Ensure StatiCrypt ran # StatiCrypt will fail without warning; verify it created a directory
# run: test -d encrypted
# - name: Copy encrypted HTML files
# run: rsync -Ir -v --include='*.html' --exclude='*.*' encrypted/docs .
# - name: Set the branch name
# run: mv docs "$BRANCH_NAME"
# - name: Install Azure CLI
# run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# - name: Delete old blobs
# run: az storage blob delete-batch -s '$web' --pattern "$BRANCH_NAME/*"
# - name: Upload to blob storage
# run: az storage blob upload-batch -s . --pattern "$BRANCH_NAME/*" -d '$web'
# - uses: actions/github-script@v6
# if: github.event_name == 'pull_request'
# with:
# script: |
# github.rest.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: `This PR has been published to https://${process.env['AZURE_STORAGE_ACCOUNT']}.z13.web.core.windows.net/${process.env['BRANCH_NAME']}/`,
# })

github_pages:
# This job only runs when committing or merging to main branch.
if: github.ref_name == 'main'
needs: docs
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 HTML docs
uses: actions/download-artifact@v3
with:
name: defending-ot-with-attack-docs-html
path: docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "defending-ot-with-attack"
version = "0.1.0"
version = "1.0.0"
description = ""
authors = ["Your Name <[email protected]>"]
license = "Apache License"
Expand Down

0 comments on commit fca33e1

Please sign in to comment.