lg-airco-modbus-mqtt/.github/workflows/build.yaml
2024-01-27 21:49:26 +01:00

60 lines
1.7 KiB
YAML

name: Build prod docker app
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: registry.hub.docker.com
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_SECRET }}
- name: Set up Docker Context for Buildx
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
endpoint: builders
- name: Get version
id: get_version
run: |
echo "VERSION=$(cat version.info)" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: registry.hub.docker.com/${{ secrets.REGISTRY_USERNAME }}/${{ github.event.repository.name }}:${{ env.VERSION }}
platforms: linux/amd64,linux/arm64
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: |
Changes in this Release:
- Docker image for version ${{ env.VERSION }} available at:
`registry.hub.docker.com/${{ secrets.REGISTRY_USERNAME }}/${{ github.event.repository.name }}:${{ env.VERSION }}`
draft: false
prerelease: false