diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..85ba065 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,40 @@ +name: Docker Image CI + +on: + push: + branches: + - "main" + +jobs: + docker: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # Authenticate to the container registry + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PAT }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # Build and push Docker image with Buildx + - name: Build and push + id: build-and-push + uses: docker/build-push-action@v6 + with: + sbom: true + provenance: true + platforms: linux/arm64,linux/amd64 + tags: ${{ github.repository }}:latest + push: true + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 1e1b21d..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Publish - -on: - push: - branches: - - main - -jobs: - docker-publish: - name: Publish to Docker Hub - if: "!contains(github.event.head_commit.message, '[ci skip]')" - runs-on: ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Bump version - uses: remorses/bump-version@js - id: version - with: - version_file: ./VERSION - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: main - - name: Set up QEMU - uses: docker/setup-qemu-action@v1.2.0 - with: - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1.6.0 - - name: Login to DockerHub - uses: docker/login-action@v1.14.1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and push - uses: docker/build-push-action@v2.10.0 - with: - context: . - push: true - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x - tags: | - dchesterton/amcrest2mqtt:latest - dchesterton/amcrest2mqtt:${{ steps.version.outputs.version }} - labels: "version=${{ steps.version.outputs.version }}" diff --git a/README.md b/README.md index 25d5905..39101fc 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,22 @@ # weirdtangent/amcrest2mqtt -Forked from dchesterton/amcrest2mqtt +Expose multiple Amcrest cameras and events to an MQTT broker, primarily +designed to work with Home Assistant. A WIP, since I'm new to Python. +Uses the [`python-amcrest`](https://github.com/tchellomello/python-amcrest) library. -A simple app to expose all events generated by Amcrest devices to MQTT using the -[`python-amcrest`](https://github.com/tchellomello/python-amcrest) library. +Forked from [dchesterton/amcrest2mqtt](https://github.com/dchesterton/amcrest2mqtt) You can define config in config.yaml and pass `-c path/to/config.yaml`. See the -config.yaml.sample file for an example. +`config.yaml.sample` file for an example. Or, we support the following environment variables and defaults: - `AMCREST_HOSTS` (required, 1+ space-separated list of hostnames/ips) - `AMCREST_NAMES` (required, 1+ space-separated list of device names - must match count of AMCREST_HOSTS) - - `AMCREST_PORT` (optional, default = 80) - `AMCREST_USERNAME` (optional, default = admin) - `AMCREST_PASSWORD` (required) + - `MQTT_USERNAME` (required) - `MQTT_PASSWORD` (optional, default = empty password) - `MQTT_HOST` (optional, default = 'localhost') @@ -25,9 +26,10 @@ Or, we support the following environment variables and defaults: - `MQTT_TLS_CA_CERT` (required if using TLS) - path to the ca certs - `MQTT_TLS_CERT` (required if using TLS) - path to the private cert - `MQTT_TLS_KEY` (required if using TLS) - path to the private key -- `MQTT_HOME_ASSISTANT_PREFIX` (optional, default = 'homeassistant') +- `MQTT_PREFIX` (optional, default = amgrest2mqtt) +- `MQTT_HOMEASSISTANT` (optional, default = true) +- `MQTT_DISCOVERY_PREFIX` (optional, default = 'homeassistant') -- `HOME_ASSISTANT` (optional, default = false) - `TZ` (required, timezone identifier, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) - `STORAGE_POLL_INTERVAL` (optional, default = 3600) - how often to fetch storage data (in seconds) (set to 0 to disable functionality) @@ -70,3 +72,5 @@ page where you can donate a small sum. Please do not feel obligated to donate in useful to myself and others, not for any financial gain - but any token of appreciation is much appreciated 🙂 Buy Me A Coffee + +