Merge pull request #133 from anshul7665/main

Adding UI build step to release workflow
This commit is contained in:
Rohan Verma 2025-06-04 12:30:33 -07:00 committed by GitHub
commit 7c8b84a46c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 9 deletions

View file

@ -123,8 +123,8 @@ jobs:
sleep 5 sleep 5
git ls-remote --tags origin | grep "refs/tags/${{ steps.tag_version.outputs.next_version }}" || (echo "Tag push verification failed!" && exit 1) git ls-remote --tags origin | grep "refs/tags/${{ steps.tag_version.outputs.next_version }}" || (echo "Tag push verification failed!" && exit 1)
echo "Tag successfully pushed." echo "Tag successfully pushed."
build_and_push_docker_image: build_and_push_backend_image:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: tag_release # Depends on the tag being created successfully needs: tag_release # Depends on the tag being created successfully
permissions: permissions:
@ -156,7 +156,7 @@ jobs:
# Optionally add 'latest' tag if building from the default branch # Optionally add 'latest' tag if building from the default branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event.inputs.branch == github.event.repository.default_branch }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event.inputs.branch == github.event.repository.default_branch }}
- name: Build and push Docker image - name: Build and push surfsense backend
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: ./surfsense_backend context: ./surfsense_backend
@ -166,3 +166,46 @@ jobs:
# Optional: Add build cache for faster builds # Optional: Add build cache for faster builds
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
build_and_push_ui_image:
runs-on: ubuntu-latest
needs: tag_release # Depends on the tag being created successfully
permissions:
packages: write # Need permission to write to GHCR
contents: read # Need permission to read repo contents (checkout)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker build
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/surfsense_ui
tags: |
# Use the tag generated in the previous job
type=raw,value=${{ needs.tag_release.outputs.new_tag }}
# Optionally add 'latest' tag if building from the default branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event.inputs.branch == github.event.repository.default_branch }}
- name: Build and push surfsense UI image
uses: docker/build-push-action@v5
with:
context: ./surfsense_web
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Optional: Add build cache for faster builds
cache-from: type=gha
cache-to: type=gha,mode=max

View file

@ -2,9 +2,7 @@ version: '3.8'
services: services:
frontend: frontend:
build: image: ghcr.io/modsetter/surfsense_ui:latest
context: ./surfsense_web
dockerfile: Dockerfile
ports: ports:
- "${FRONTEND_PORT:-3000}:3000" - "${FRONTEND_PORT:-3000}:3000"
volumes: volumes:
@ -16,9 +14,7 @@ services:
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://backend:8000} - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://backend:8000}
backend: backend:
build: image: ghcr.io/modsetter/surfsense_backend:latest
context: ./surfsense_backend
dockerfile: Dockerfile
ports: ports:
- "${BACKEND_PORT:-8000}:8000" - "${BACKEND_PORT:-8000}:8000"
volumes: volumes: