Use matrix builds (#2172)

This commit is contained in:
Joakim Sørensen 2020-10-25 13:08:17 +01:00 committed by GitHub
parent fd4b3ee539
commit 007251a04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,42 +16,62 @@ on:
- setup.py - setup.py
env: env:
BUILD_NAME: supervisor # This needs to match the key in the version file BUILD_NAME: supervisor
BUILD_TYPE: supervisor # Can be plugin, core, supervisor or generic BUILD_TYPE: supervisor
jobs: jobs:
build: init:
name: Build supervisor name: Initialize build
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
architectures: ${{ steps.info.outputs.architectures }}
version: ${{ steps.version.outputs.version }}
channel: ${{ steps.version.outputs.channel }}
publish: ${{ steps.version.outputs.publish }}
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Get information
id: info
uses: home-assistant/actions/helpers/info@master
- name: Get version - name: Get version
id: version id: version
uses: home-assistant/actions/helpers/version@master uses: home-assistant/actions/helpers/version@master
with: with:
type: ${{ env.BUILD_TYPE }} type: ${{ env.BUILD_TYPE }}
- name: Initialize git build:
if: steps.version.outputs.publish == 'true' name: Build ${{ matrix.arch }} supervisor
uses: home-assistant/actions/helpers/git-init@master needs: init
runs-on: ubuntu-latest
strategy:
matrix:
arch: ${{ fromJson(needs.init.outputs.architectures) }}
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with: with:
name: ${{ secrets.GIT_NAME }} fetch-depth: 0
email: ${{ secrets.GIT_EMAIL }}
token: ${{ secrets.GIT_TOKEN }} - name: Set version
if: needs.init.outputs.publish == 'true'
uses: home-assistant/actions/helpers/version@master
with:
type: ${{ env.BUILD_TYPE }}
- name: Login to DockerHub - name: Login to DockerHub
if: steps.version.outputs.publish == 'true' if: needs.init.outputs.publish == 'true'
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set build arguments - name: Set build arguments
if: steps.version.outputs.publish == 'false' if: needs.init.outputs.publish == 'false'
run: echo "BUILD_ARGS=--test" >> $GITHUB_ENV run: echo "BUILD_ARGS=--test" >> $GITHUB_ENV
- name: Build supervisor - name: Build supervisor
@ -59,14 +79,31 @@ jobs:
with: with:
args: | args: |
$BUILD_ARGS \ $BUILD_ARGS \
--all \ --${{ matrix.arch }} \
--target /data \ --target /data \
--generic ${{ steps.version.outputs.version }} --generic ${{ needs.init.outputs.version }}
version:
name: Update version
needs: ["init", "build"]
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
if: needs.init.outputs.publish == 'true'
uses: actions/checkout@v2
- name: Initialize git
if: needs.init.outputs.publish == 'true'
uses: home-assistant/actions/helpers/git-init@master
with:
name: ${{ secrets.GIT_NAME }}
email: ${{ secrets.GIT_EMAIL }}
token: ${{ secrets.GIT_TOKEN }}
- name: Update version file - name: Update version file
if: steps.version.outputs.publish == 'true' if: needs.init.outputs.publish == 'true'
uses: home-assistant/actions/helpers/version-push@master uses: home-assistant/actions/helpers/version-push@master
with: with:
key: ${{ env.BUILD_NAME }} key: ${{ env.BUILD_NAME }}
version: ${{ steps.version.outputs.version }} version: ${{ needs.init.outputs.version }}
channel: ${{ steps.version.outputs.channel }} channel: ${{ needs.init.outputs.channel }}