ha-matter-bridge/.github/workflows/docker-image.yml

47 lines
1.3 KiB
YAML
Raw Normal View History

2024-01-26 23:19:14 +01:00
name: Publish Docker image
2024-01-30 11:32:43 +01:00
on: push
2024-01-26 23:19:14 +01:00
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
2024-01-30 11:32:43 +01:00
- name: Run read-yaml action
id: yaml-data
uses: jbutcher5/read-yaml@1.6
with:
file: "./matter-bridge/config.yml"
key-path: '["version"]'
- name: Display read-yaml output
run: echo "${{ steps.yaml-data.outputs.data }}"
2024-01-26 23:19:14 +01:00
- name: Log in to the Container registry
2024-01-30 11:32:43 +01:00
uses: docker/login-action@v3.0.0
2024-01-26 23:19:14 +01:00
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR }}
2024-01-30 11:32:43 +01:00
2024-01-26 23:19:14 +01:00
- name: Extract metadata (tags, labels) for Docker
id: meta
2024-01-30 11:32:43 +01:00
uses: docker/metadata-action@v5
2024-01-26 23:19:14 +01:00
with:
images: ghcr.io/${{ github.repository }}
2024-01-30 11:32:43 +01:00
tags: |
type=raw,value=${{ steps.yaml-data.outputs.data }}
type=raw,value=latest
2024-01-26 23:19:14 +01:00
- name: Build and push Docker image
2024-01-30 11:32:43 +01:00
uses: docker/build-push-action@v5.1.0
2024-01-26 23:19:14 +01:00
with:
context: ./matter-bridge
file: ./matter-bridge/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}