⬆️ Update docker/build-push-action action to v6.11.0 #433
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
workflow_dispatch: | |
jobs: | |
workflows: | |
uses: hassio-addons/workflows/.github/workflows/addon-ci.yaml@main | |
check_image: | |
runs-on: ubuntu-latest | |
needs: workflows | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v4 | |
- name: 🚀 Run add-on information action | |
id: information | |
uses: frenck/action-addon-information@v1.4.2 | |
- name: 🚀 Process possible slug override | |
id: override | |
run: | | |
slug="${{ steps.information.outputs.slug }}" | |
if [[ ! -z "${{ inputs.slug }}" ]]; then | |
slug="${{ inputs.slug }}" | |
fi | |
echo "slug=$slug" >> "$GITHUB_OUTPUT" | |
- name: ℹ️ Gather version and environment | |
id: release | |
run: | | |
sha="${{ github.sha }}" | |
environment="edge" | |
version="${sha:0:7}" | |
echo "environment=${environment}" >> "$GITHUB_OUTPUT" | |
echo "version=${version}" >> "$GITHUB_OUTPUT" | |
- name: 🏗 Set up build cache | |
id: cache | |
uses: actions/cache@v4.2.0 | |
with: | |
path: /tmp/.docker-cache | |
key: docker-amd64-${{ github.sha }} | |
restore-keys: | | |
docker-amd64 | |
- name: 🏗 Set up QEMU | |
uses: docker/setup-qemu-action@v3.2.0 | |
- name: 🏗 Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3.8.0 | |
- name: 🏗 Login to GitHub Container Registry | |
uses: docker/login-action@v3.3.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: ℹ️ Compose build flags | |
id: flags | |
run: | | |
echo "date=$(date +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT" | |
from=$(yq --no-colors eval ".build_from.amd64" "${{ steps.information.outputs.build }}") | |
echo "from=${from}" >> "$GITHUB_OUTPUT" | |
echo "${from}" | |
- name: 🚀 Build | |
uses: docker/build-push-action@v6.11.0 | |
with: | |
load: true | |
tags: | | |
${{ github.repository_owner }}/${{ steps.information.outputs.slug }}/amd64:${{ steps.release.outputs.version }} | |
context: ${{ steps.information.outputs.target }} | |
file: ${{steps.information.outputs.target }}/Dockerfile | |
cache-from: | | |
type=local,src=/tmp/.docker-cache | |
ghcr.io/${{ github.repository_owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge | |
cache-to: type=local,mode=max,dest=/tmp/.docker-cache | |
platforms: ${{ steps.flags.outputs.platform }} | |
build-args: | | |
BUILD_ARCH=amd64 | |
BUILD_DATE=${{ steps.flags.outputs.date }} | |
BUILD_FROM=${{ steps.flags.outputs.from }} | |
BUILD_REF=${{ github.sha }} | |
BUILD_REPOSITORY=${{ github.repository }} | |
BUILD_VERSION=dev | |
# install goss and dgoss | |
- name: Install pytest-testinfra | |
run: | | |
pip install uv | |
uv virtualenv | |
uv pip install -r requirements.txt | |
# run goss tests | |
- name: Run testinfra | |
run: | | |
. .venv/bin/activate | |
pytest --image "${{ github.repository_owner }}/${{ steps.information.outputs.slug }}/amd64:${{ steps.release.outputs.version }}" |