diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a20f418..f4a2946 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,8 +35,11 @@ jobs: release: + if: github.repository == 'SpecterOps/BloodHoundQueryLibrary' runs-on: ubuntu-latest needs: test + permissions: + contents: write steps: - uses: actions/checkout@v4 - name: Set up Python 3.10 @@ -56,6 +59,16 @@ jobs: - name: Convert queries into single json file run: | python utilities/python/convert.py ./queries ./Queries.json + + - name: Stage GitHub Pages site + run: | + mkdir pages + cp Queries.json pages/Queries.json + + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v4 + with: + path: pages - name: Set metadata id: release_meta @@ -76,3 +89,17 @@ jobs: body: | This release contains all queries exported as JSON and bundled in a single file. The compressed .zip file can be uploaded to BloodHound to bulk-import all queries. draft: true + + deploy-pages: + runs-on: ubuntu-latest + needs: release + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/tests/conftest.py b/tests/conftest.py index 6bc82d7..e611966 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -47,7 +47,7 @@ def pytest_sessionfinish(self, session: pytest.Session) -> None: ) template = env.get_template("githubsummary.md.j2") rendered = template.render(data=self.results) - with open("test-report.md", "w") as f: + with open("test-report.md", "w", encoding="utf-8") as f: f.write(rendered)