107 lines
2.9 KiB
YAML
107 lines
2.9 KiB
YAML
name: Build base images
|
|
|
|
on:
|
|
pull_request:
|
|
branches: ["master"]
|
|
release:
|
|
types: ["published"]
|
|
|
|
env:
|
|
BUILD_TYPE: base
|
|
|
|
jobs:
|
|
init:
|
|
name: Initialize build
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
architectures: ${{ steps.info.outputs.architectures }}
|
|
version: ${{ steps.version.outputs.version }}
|
|
steps:
|
|
- name: Checkout the repository
|
|
uses: actions/checkout@v3.5.3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Get information
|
|
id: info
|
|
uses: home-assistant/actions/helpers/info@master
|
|
|
|
- name: Get version
|
|
id: version
|
|
uses: home-assistant/actions/helpers/version@master
|
|
with:
|
|
type: ${{ env.BUILD_TYPE }}
|
|
|
|
build:
|
|
name: Build ${{ matrix.arch }} base image
|
|
needs: init
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
arch: ${{ fromJson(needs.init.outputs.architectures) }}
|
|
steps:
|
|
- name: Checkout the repository
|
|
uses: actions/checkout@v3.5.3
|
|
|
|
- name: Get changed files
|
|
id: changed_files
|
|
if: github.event_name != 'release'
|
|
uses: jitterbit/get-changed-files@v1
|
|
|
|
- name: Check if requirements files changed
|
|
id: requirements
|
|
run: |
|
|
if [[ "${{ steps.changed_files.outputs.all }}" =~ requirements.txt ]]; then
|
|
echo "changed=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Build wheels
|
|
uses: home-assistant/wheels@2023.04.0
|
|
if: steps.requirements.outputs.changed == 'true'
|
|
with:
|
|
tag: musllinux_1_2
|
|
abi: cp310
|
|
arch: ${{ matrix.arch }}
|
|
wheels-key: ${{ secrets.WHEELS_KEY }}
|
|
apk: "mariadb-dev;postgresql-dev;libffi-dev"
|
|
requirements: "requirements.txt"
|
|
|
|
- name: Build wheels cp311
|
|
uses: home-assistant/wheels@2023.04.0
|
|
if: steps.requirements.outputs.changed == 'true'
|
|
with:
|
|
tag: musllinux_1_2
|
|
abi: cp311
|
|
arch: ${{ matrix.arch }}
|
|
wheels-key: ${{ secrets.WHEELS_KEY }}
|
|
apk: "mariadb-dev;postgresql-dev;libffi-dev"
|
|
requirements: "requirements.txt"
|
|
|
|
- name: Login to GitHub Container Registry
|
|
if: github.event_name == 'release'
|
|
uses: docker/login-action@v2.2.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set build arguments
|
|
if: github.event_name != 'release'
|
|
run: echo "BUILD_ARGS=--test" >> $GITHUB_ENV
|
|
|
|
- name: Build base image
|
|
uses: home-assistant/builder@2023.08.0
|
|
with:
|
|
args: |
|
|
$BUILD_ARGS \
|
|
--${{ matrix.arch }} \
|
|
--target /data \
|
|
--cosign \
|
|
--generic ${{ needs.init.outputs.version }}
|
|
env:
|
|
CAS_API_KEY: ${{ secrets.CAS_TOKEN }}
|