.github/workflows/build_bundles.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sat, 13 Aug 2022 17:00:47 +0200
changeset 88 58cff3acaf3d
parent 84 8e01f3bb59df
child 93 b1f29a911785
permissions -rw-r--r--
GH CD: attempt to preserve content of build/source by swapping checkout and artifact download steps.
name: Build windows installer in Docker

on:
  workflow_dispatch:
  # push:
  #   branches: [ default ]

jobs:
  sources:
    uses: ./.github/workflows/prep_sources.yml

  build:
    needs: sources
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
      with:
          path: beremiz_public_dist

    - name: Download source artifact
      uses: actions/download-artifact@v3
      with:
        name: source_package

    - name: Cache docker image
      id: cache-docker
      uses: actions/cache@v3
      env:
        cache-name: cache-docker
      with:
        path: /tmp/latest.tar
        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('beremiz_public_dist/Dockerfile', 'beremiz_public_dist/*.sh') }}

    - if: ${{ steps.cache-docker.outputs.cache-hit == false }}
      name: Create docker image
      run: |
        cd beremiz_public_dist
        ./build_docker_image.sh
        docker image save --output="/tmp/latest.tar" beremiz_public_builder

    - if: ${{ steps.cache-docker.outputs.cache-hit != false }}
      name: Re-use docker image
      run: |
        docker image load --input="/tmp/latest.tar" 

    - name: Create docker container
      run: |
        cd beremiz_public_dist
        ./create_docker_container.sh ${{ github.workspace }}/build

    - name: Run build in docker
      run: |
        cd beremiz_public_dist
        # override HG revision IDs in Makefile
        ./build_in_docker.sh \
            beremiz_revisionid=${{ needs.sources.outputs.beremiz_revisionid }} \
            matiec_revisionid=${{ needs.sources.outputs.matiec_revisionid }} \
            canfestival_revisionid=${{ needs.sources.outputs.canfestival_revisionid }} \
            Modbus_revisionid=${{ needs.sources.outputs.Modbus_revisionid }} \
            open62541_revisionid=${{ needs.sources.outputs.open62541_revisionid }}

    - name: Upload built artifact
      uses: actions/upload-artifact@v3
      with:
        name: windows_bundles
        path: |
          ${{ github.workspace }}/build/Beremiz-*.exe
          ${{ github.workspace }}/build/Beremiz-*.zip
        retention-days: 5