aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/mxe-dockerimage-stage2.yml
blob: d1d6409752e95366add578ffb3e1984f0508fb3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: MXE stage 2 Docker Image CI

# trigger this second stage via a repository dispaych event
# the version that we are building is passed in via the event type that is available to us here
# as github.event.action

on: repository_dispatch

jobs:
  mxe-build-container-stage2:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
      with:
        ref: ${{ github.event.client_payload.target_branch }}

      # Grab the version from the event name that we were triggered by and add ".stage1" to find the docker image to start FROM
      # And create the NAME of the final docker image (including the branch if not master)
    - name: set env
      run: |
        v=${{ github.event.action }}
        s=".stage1"
        b=${{ github.event.client_payload.target_branc }} # -BRANCH suffix, unless the branch is master
        b=${b/refs\/heads\//}
        if [ $b = "master" ] ; then b="" ; else b="-$b" ; fi
        echo "::set-env name=VERSION::${v}${s}"
        echo "::set-env name=NAME::subsurface/mxe-build-container${b}:${v}"

    - name: Build and Publish stage 2 Docker image to Dockerhub
      uses: elgohr/Publish-Docker-Github-Action@master
      with:
        name:       ${{ env.NAME }}
        username:   ${{ secrets.DOCKER_USERNAME }}
        password:   ${{ secrets.DOCKER_PASSWORD }}
        dockerfile: 'Dockerfile-stage2'
        workdir:    './scripts/docker/mxe-build-container/'
        buildargs:  VERSION