.github/workflows/build_bundles.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Thu, 28 Jul 2022 16:54:04 +0200
changeset 68 8eb533b797be
parent 67 d06ee9c3f780
child 73 5b6508694623
permissions -rw-r--r--
GH action : split workflows for later re-use of source provisioning.
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     1
name: Build windows installer in Docker.
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
on:
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     4
  workflow_dispatch:
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     5
  # push:
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     6
  #   branches: [ default ]
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
jobs:
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     9
  sources:
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    10
    uses: ./.github/workflow/prep_sources
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
  build:
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
    runs-on: ubuntu-latest
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
    steps:
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    16
    - name: Cache docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    17
      id: cache-docker
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    18
      uses: actions/cache@v3
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    19
      env:
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    20
        cache-name: cache-docker
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    21
      with:
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    22
        path: /tmp/latest.tar
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    23
        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('beremiz_public_dist/Dockerfile', 'beremiz_public_dist/*.sh') }}
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    24
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    25
    - if: ${{ steps.cache-docker.outputs.cache-hit == false }}
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    26
      name: Create docker image
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    27
      run: |
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    28
        cd beremiz_public_dist
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    29
        ./build_docker_image.sh
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    30
        docker image save --output="/tmp/latest.tar" beremiz_public_builder
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    31
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    32
    - if: ${{ steps.cache-docker.outputs.cache-hit != false }}
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    33
      name: Re-use docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    34
      run: |
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    35
        docker image load --input="/tmp/latest.tar" 
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    36
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    37
    - name: Create docker container
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    38
      run: |
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    39
        cd beremiz_public_dist
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    40
        ./create_docker_container.sh ${{ github.workspace }}/build
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    41
48
e191f60ab947 Github Action Workflow : desperate attempt to pass environment variable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    42
    - name: Run build in docker
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    43
      run: |
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    44
        cd beremiz_public_dist
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    45
        # override HG revision IDs in Makefile
59
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 56
diff changeset
    46
        ./build_in_docker.sh \
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    47
            beremiz_revisionid=${{ needs.sources.outputs.beremiz_revisionid }} \
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    48
            matiec_revisionid=${{ needs.sources.outputs.matiec_revisionid }} \
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    49
            canfestival_revisionid=${{ needs.sources.outputs.canfestival_revisionid }}
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    50
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    51
    - name: Upload built artifact
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    52
      uses: actions/upload-artifact@v3
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    53
      with:
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    54
        name: windows_bundles
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    55
        path: |
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    56
          ${{ github.workspace }}/build/Beremiz-*.exe
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    57
          ${{ github.workspace }}/build/Beremiz-*.zip
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    58
        retention-days: 5
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    59