Skip to content

Commit

Permalink
dynamically define the strategy matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 25, 2021
1 parent d790118 commit 09f1347
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/build-docker.yml
@@ -1,7 +1,13 @@
name: Build Docker images for current branches

# on commits to this file, schedule and dispatch runs, the workflow will build the 3 different Docker images (master, PR, LTR)
# on tags, it will build only the image of the given tag
# this is made by using a matrix defined in a dedicated job

on:
push:
tags:
- final-*
branches:
- master
paths:
Expand All @@ -13,6 +19,19 @@ on:
# POST https://api.github.com/repos/qgis/QGIS/actions/workflows/2264135/dispatches:

jobs:
define-strategy:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- id: matrix
run: |
if [[ "${GITHUB_REF}" =~ ^refs/tags ]]; then
echo "::set-output name=matrix::{\"branch\":[\"${GITHUB_REF##*/}\"]}"
else
echo "::set-output name=matrix::{\"branch\":[\"master\", \"release-3_16\", \"release-3_18\"]}"
fi
build-docker:
runs-on: ubuntu-latest

Expand All @@ -24,8 +43,7 @@ jobs:
CXX: /usr/lib/ccache/g++ # Building SIP binding freezes with Clang in Docker, maybe a SIP issue, maybe not

strategy:
matrix:
branch: [master, release-3_16, release-3_18]
matrix: ${{ fromJSON( needs.define-strategy.outputs.matrix ) }}

steps:
- name: Cache
Expand Down

0 comments on commit 09f1347

Please sign in to comment.