diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..b08b967 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,62 @@ +name: Build and Release + +on: + push: + branches: + - main + +permissions: + contents: read + packages: write + +jobs: + build: + name: Build and Push Docker Image to Hub + + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/homedb:${{ github.sha }} + + release: + name: Create GitHub Release + needs: build + + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: Get Version + run: | + VERSION=$(grep -Po '(?<=version = ")[^"]*' pyproject.toml) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Delete existing release if it exists + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release delete ${{ env.VERSION }} -y || echo "Release does not exist, continuing..." + + - name: Create GitHub Release + id: create_release + env: + GH_TOKEN: ${{ github.token }} + run: | + RELEASE_NOTES="Docker Hub: https://hub.docker.com/r/${{ secrets.DOCKER_USERNAME }}/homedb" + gh release create ${{ env.VERSION }} --title "HomeDB - v${{ env.VERSION }}" --notes "$RELEASE_NOTES" --generate-notes diff --git a/README.md b/README.md index 325b24f..3b3a7f4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ HomeDB is a Database for the Home. It is built in Django using a Simple sqlite Database and YAML Configuration Stored Locally in the Filesystem. -![Network Devices Demo Image](image.png) +![Network Devices Demo Image](static/assets/image.png) ## Features diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..824be4e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.8' + +services: + web: + build: . + command: python manage.py runserver 0.0.0.0:8000 + volumes: + - .:/code + ports: + - "8000:8000" + environment: + - DEBUG=True + - ALLOWED_HOSTS=localhost,127.0.0.1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5536fe9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[project] +name = "HomeDB" +version = "1.0" +description = "HomeDB is a Database for the Home." +readme = "README.md" +authors = [ + { name = "Ben Burwood", email = "ben.burwood@outlook.com" } +] + +[project.urls] +Homepage = "https://github.com/ben-burwood/HomeDB" + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} diff --git a/image.png b/static/assets/image.png similarity index 100% rename from image.png rename to static/assets/image.png