Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:

permissions:
contents: write
packages: write
pages: write
id-token: write

Expand All @@ -45,17 +46,26 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements_ci.txt

- name: Train demo model and build static site
- name: Log in to GitHub Container Registry (GHCR)
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set image name
id: set-image
run: |
python simple_demo.py
python generate_site.py
# create lowercase owner name (GHCR requires lowercase owner/org)
owner_lower=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
image_latest="ghcr.io/${owner_lower}/mindguard:latest"
image_sha="ghcr.io/${owner_lower}/mindguard:${GITHUB_SHA}"
echo "image_latest=$image_latest" >> $GITHUB_OUTPUT
echo "image_sha=$image_sha" >> $GITHUB_OUTPUT

- name: Deploy site to gh-pages branch
uses: peaceiris/actions-gh-pages@v3
- name: Build and push Docker image (runs app.py)
uses: docker/build-push-action@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
publish_branch: gh-pages
# keep repository history small by not committing other files
user_name: github-actions[bot]
user_email: github-actions[bot]@users.noreply.github.com
context: .
push: true
tags: ${{ steps.set-image.outputs.image_latest }},${{ steps.set-image.outputs.image_sha }}