From fa86d5072bc462fa0813eaf783fbc559d689d0df Mon Sep 17 00:00:00 2001 From: gr1shan1a <368409@edu.itmo.ru> Date: Thu, 27 Nov 2025 20:34:09 +0800 Subject: [PATCH 1/2] <27.11.2025 20:33> --- .github/workflows/publish.yml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b200904..50cc6e6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,17 +45,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 image name (GHCR requires lowercase names) + repo_lower=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]') + image_latest="ghcr.io/${repo_lower}/mindguard:latest" + image_sha="ghcr.io/${repo_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 }} From 4d130ff541e8cf26488df077107f3c66dafbcdda Mon Sep 17 00:00:00 2001 From: gr1shan1a <368409@edu.itmo.ru> Date: Thu, 27 Nov 2025 20:37:40 +0800 Subject: [PATCH 2/2] <27.11.2025 20:37> --- .github/workflows/publish.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 50cc6e6..bed718f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,6 +19,7 @@ on: permissions: contents: write + packages: write pages: write id-token: write @@ -55,10 +56,10 @@ jobs: - name: Set image name id: set-image run: | - # create lowercase image name (GHCR requires lowercase names) - repo_lower=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]') - image_latest="ghcr.io/${repo_lower}/mindguard:latest" - image_sha="ghcr.io/${repo_lower}/mindguard:${GITHUB_SHA}" + # 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