init commit #3
This file contains hidden or 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: BUILD | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| variables: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| ARCH_LIST: ${{ env.ARCH_LIST }} | |
| ADDON_LIST: ${{ env.ADDON_LIST }} | |
| DOCKER_ARGS: ${{ env.DOCKER_ARGS }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: "ARGS: default" | |
| run: | | |
| echo "ADDON_LIST=['silabs-multiprotocol-ember']" >> $GITHUB_ENV | |
| echo "DOCKER_ARGS=--no-latest --test" >> $GITHUB_ENV | |
| - name: "ARGS: zigbee2mqtt" # Build of addon release version | |
| if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' | |
| run: | | |
| echo "ADDON_LIST=['silabs-multiprotocol-ember']" >> $GITHUB_ENV | |
| echo "DOCKER_ARGS=--no-cache --docker-hub-check" >> $GITHUB_ENV | |
| - name: Determine arch | |
| id: determine_arch | |
| run: | | |
| ARCH_LIST=$(jq -r -c '.arch' ./${{ fromJSON(env.ADDON_LIST)[0] }}/config.json) | |
| echo "Found the following arches: $ARCH_LIST" | |
| echo "ARCH_LIST=$ARCH_LIST" >> $GITHUB_ENV | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: variables | |
| env: | |
| DOCKER_ARGS: ${{needs.variables.outputs.DOCKER_ARGS}} | |
| strategy: | |
| matrix: | |
| arch: ${{fromJSON(needs.variables.outputs.ARCH_LIST)}} | |
| addon: ${{fromJSON(needs.variables.outputs.ADDON_LIST)}} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Docker login | |
| if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | |
| run: echo ${{ secrets.DOCKER_KEY }} | docker login -u koenkk --password-stdin | |
| - name: Build | |
| run: | | |
| if [ "${{ matrix.addon }}" != "zigbee2mqtt-proxy" ]; then | |
| cp -R common/rootfs ${{ matrix.addon }} | |
| cp common/Dockerfile ${{ matrix.addon }} | |
| fi | |
| cp common/build.yaml ${{ matrix.addon }} | |
| docker run --rm --privileged \ | |
| -v /home/runner/.docker:/root/.docker \ | |
| -v /run/docker.sock:/run/docker.sock:rw \ | |
| -v $(pwd)/${{ matrix.addon }}:/data homeassistant/amd64-builder --${{ matrix.arch }} -t /data \ | |
| ${{ env.DOCKER_ARGS }} |