diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..cab4267 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,15 @@ +on: + push: + +name: Build + +jobs: + + docker-build: + name: Build Docker image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build Docker image + run: | + docker build -t ghcr.io/spaceapi-community/spaceapi-sensor-logger:latest . diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 025b2c9..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,36 +0,0 @@ -on: - push: - schedule: - - cron: '30 3 * * 2' - -name: CI - -jobs: - - docker-build: - name: Build Docker image - runs-on: ubuntu-latest - if: github.ref != 'refs/heads/master' - steps: - - uses: actions/checkout@v2 - - name: Build Docker image - run: | - docker build -t spaceapi/influxdb-sensor-logger:latest . - - docker-publish: - name: Publish Docker image - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - steps: - - uses: actions/checkout@v2 - - name: Build Docker image - run: | - docker build \ - --no-cache \ - -t spaceapi/influxdb-sensor-logger:latest \ - -t spaceapi/influxdb-sensor-logger:v1 \ - . - - name: Push Docker image - run: | - docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" && \ - docker push -a spaceapi/influxdb-sensor-logger diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8ecb782 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +on: + push: + branches: + - master + schedule: + - cron: '30 3 * * 2' + +name: Publish + +jobs: + + docker-publish: + name: Publish Docker image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build Docker image + run: | + docker build \ + --no-cache \ + -t ghcr.io/spaceapi-community/spaceapi-sensor-logger:latest \ + -t ghcr.io/spaceapi-community/spaceapi-sensor-logger:v1 \ + --label "org.opencontainers.image.source=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \ + . + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Push Docker image + run: | + docker push -a ghcr.io/spaceapi-community/spaceapi-sensor-logger diff --git a/README.md b/README.md index 256e861..972aa06 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SpaceAPI InfluxDB Sensor Logger -[![Docker Image Size (tag)](https://img.shields.io/docker/image-size/spaceapi/influxdb-sensor-logger/latest)](https://hub.docker.com/r/spaceapi/influxdb-sensor-logger) +[![Docker Image][docker-image-badge]][docker-image] A Python 3 script to relay sensor values from a SpaceAPI endpoint to an InfluxDB instance so it can be viewed in Grafana. @@ -41,7 +41,7 @@ Configure it using the following env vars: - `SPACEAPI_ENDPOINT` - `RELAY_INTERVAL_SECONDS` -The image is published at [docker.io/spaceapi/influxdb-sensor-logger](https://hub.docker.com/r/spaceapi/influxdb-sensor-logger). +The image is published at [ghcr.io/spaceapi-community/spaceapi-sensor-logger](https://ghcr.io/spaceapi-community/spaceapi-sensor-logger). ## License @@ -60,3 +60,6 @@ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + +[docker-image]: https://ghcr.io/spaceapi-community/spaceapi-sensor-logger +[docker-image-badge]: https://img.shields.io/badge/container%20image-ghcr.io/spaceapi-community/spaceapi-sensor-logger-blue.svg