mirror of
https://github.com/lildude/ha-addon-teslamate.git
synced 2026-10-13 21:19:16 -04:00
94 lines
3.2 KiB
YAML
94 lines
3.2 KiB
YAML
name: teslamate
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
paths:
|
|
- 'teslamate/**'
|
|
- '!**.md'
|
|
- '.github/workflows/teslamate.yml'
|
|
|
|
jobs:
|
|
build:
|
|
env:
|
|
TESLAMATE_TAG: 1.20.1
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64, armhf, armv7, aarch64]
|
|
fail-fast: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: 'true'
|
|
- name: Docker version
|
|
run: docker version
|
|
- name: Setup qemu
|
|
id: qemu
|
|
uses: docker/setup-qemu-action@v1
|
|
with:
|
|
platforms: all
|
|
- name: Install buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
version: latest
|
|
- name: Available platforms
|
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
- name: Set PLATFORM variable
|
|
run: |
|
|
case "${{ matrix.arch }}" in
|
|
"amd64" )
|
|
echo "PLATFORM=linux/amd64" >> $GITHUB_ENV ;;
|
|
"i386" )
|
|
echo "PLATFORM=linux/386" >> $GITHUB_ENV ;;
|
|
"aarch64" )
|
|
echo "PLATFORM=linux/arm64" >> $GITHUB_ENV ;;
|
|
"armhf" )
|
|
echo "PLATFORM=linux/arm/v7" >> $GITHUB_ENV ;;
|
|
"armv7" )
|
|
echo "PLATFORM=linux/arm/v7" >> $GITHUB_ENV ;;
|
|
esac
|
|
- name: Set environment variables from config.json
|
|
run: |
|
|
echo "ADDON_VERSION=$(jq -r .version < $GITHUB_WORKFLOW/config.json)" >> $GITHUB_ENV
|
|
echo "ADDON_NAME=$(jq -r .name < $GITHUB_WORKFLOW/config.json)" >> $GITHUB_ENV
|
|
echo "ADDON_DESCRIPTION=$(jq -r .description < $GITHUB_WORKFLOW/config.json)" >> $GITHUB_ENV
|
|
- name: Login to docker hub
|
|
run: sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: Buildx build (if not main)
|
|
run: |
|
|
DOCKER_CLI_EXPERIMENTAL=enabled sudo docker buildx build \
|
|
--pull \
|
|
--platform=$PLATFORM \
|
|
--build-arg TESLAMATE_TAG=$TESLAMATE_TAG \
|
|
--label io.hass.type="addon" \
|
|
--label io.hass.name="$ADDON_NAME" \
|
|
--label io.hass.description="$ADDON_DESCRIPTION" \
|
|
--label io.hass.version="$ADDON_VERSION" \
|
|
--label io.hass.arch="${{ matrix.arch }}" \
|
|
--label io.hass.url="https://github.com/matt-FFFFFF/hassio-addon-repository/blob/main/teslamate/README.md" \
|
|
-t ${{ secrets.DOCKER_USERNAME }}/teslamate-${{ matrix.arch }}:$ADDON_VERSION \
|
|
./$GITHUB_WORKFLOW
|
|
if: github.ref != 'refs/heads/main'
|
|
- name: Buildx build --push (if main)
|
|
run: |
|
|
DOCKER_CLI_EXPERIMENTAL=enabled sudo docker buildx build \
|
|
--pull \
|
|
--push \
|
|
--platform=$PLATFORM \
|
|
--build-arg TESLAMATE_TAG=$TESLAMATE_TAG \
|
|
--label io.hass.type="addon" \
|
|
--label io.hass.name="$ADDON_NAME" \
|
|
--label io.hass.description="$ADDON_DESCRIPTION" \
|
|
--label io.hass.version="$ADDON_VERSION" \
|
|
--label io.hass.arch="${{ matrix.arch }}" \
|
|
--label io.hass.url="https://github.com/matt-FFFFFF/hassio-addon-repository/blob/main/teslamate/README.md" \
|
|
-t ${{ secrets.DOCKER_USERNAME }}/teslamate-${{ matrix.arch }}:$ADDON_VERSION \
|
|
./$GITHUB_WORKFLOW
|
|
if: github.ref == 'refs/heads/main'
|