mirror of
https://github.com/lildude/ha-addon-teslamate.git
synced 2026-10-13 13:10:30 -04:00
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
118 lines
3.9 KiB
YAML
118 lines
3.9 KiB
YAML
name: Teslamate CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- '**'
|
|
- '!**.md'
|
|
- '!.github/**'
|
|
release:
|
|
types: [published]
|
|
pull_request:
|
|
paths:
|
|
- '**'
|
|
- '!**.md'
|
|
|
|
env:
|
|
DOCKER_USERNAME: mattffffff
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
arch: [amd64, armhf, armv7, aarch64]
|
|
fail-fast: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: 'true'
|
|
- name: Set TESLAMATE_TAG
|
|
run: |
|
|
echo "TESLAMATE_TAG=$(jq -r '.args.TESLAMATE_TAG ' < build.json)" >> $GITHUB_ENV
|
|
- name: Docker version
|
|
run: docker version
|
|
- name: Setup qemu
|
|
id: qemu
|
|
uses: docker/setup-qemu-action@v3
|
|
with:
|
|
platforms: all
|
|
- name: Install buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
version: latest
|
|
- name: Available platforms
|
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
- name: Set PLATFORM & ARCH variables
|
|
run: |
|
|
case "${{ matrix.arch }}" in
|
|
"amd64" )
|
|
echo "PLATFORM=linux/amd64" >> $GITHUB_ENV
|
|
echo "ARCH=amd64" >> $GITHUB_ENV
|
|
;;
|
|
"aarch64" )
|
|
echo "PLATFORM=linux/arm64" >> $GITHUB_ENV
|
|
echo "ARCH=aarch64" >> $GITHUB_ENV
|
|
;;
|
|
"armhf" )
|
|
echo "PLATFORM=linux/arm/v7" >> $GITHUB_ENV
|
|
echo "ARCH=armhf" >> $GITHUB_ENV
|
|
;;
|
|
"armv7" )
|
|
echo "PLATFORM=linux/arm/v7" >> $GITHUB_ENV
|
|
echo "ARCH=arm" >> $GITHUB_ENV
|
|
;;
|
|
esac
|
|
- name: Update config.json if release
|
|
run: |
|
|
export RELEASE=$( echo $GITHUB_REF | cut -d/ -f3 | sed s/v// )
|
|
jq ".version=\"$RELEASE\"" < config.json > config_release.json
|
|
rm config.json && mv config_release.json config.json
|
|
if: ${{ github.event_name == 'release' }}
|
|
- name: Set environment variables from config.json
|
|
run: |
|
|
echo "ADDON_VERSION=$(jq -r .version < config.json)" >> $GITHUB_ENV
|
|
echo "ADDON_NAME=$(jq -r .name < config.json)" >> $GITHUB_ENV
|
|
echo "ADDON_DESCRIPTION=$(jq -r .description < config.json)" >> $GITHUB_ENV
|
|
- name: Login to docker hub
|
|
run: sudo docker login -u $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 \
|
|
--build-arg ARCH=$ARCH \
|
|
--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 $DOCKER_USERNAME/teslamate-${{ matrix.arch }}:$ADDON_VERSION \
|
|
./
|
|
if: ${{ github.ref != 'refs/heads/main' }}
|
|
- name: Buildx build --push (if main or release)
|
|
run: |
|
|
DOCKER_CLI_EXPERIMENTAL=enabled sudo docker buildx build \
|
|
--pull \
|
|
--push \
|
|
--platform=$PLATFORM \
|
|
--build-arg TESLAMATE_TAG=$TESLAMATE_TAG \
|
|
--build-arg ARCH=$ARCH \
|
|
--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 $DOCKER_USERNAME/teslamate-${{ matrix.arch }}:$ADDON_VERSION \
|
|
./
|
|
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
|