From a56e6980c58c168ddc1a50612e7bd3e35c7f17c6 Mon Sep 17 00:00:00 2001 From: Stefaan Ghysels Date: Sat, 28 Nov 2020 21:52:27 +0100 Subject: [PATCH] Use actions matrix --- .github/workflows/wdpk.yml | 53 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/.github/workflows/wdpk.yml b/.github/workflows/wdpk.yml index d3f3b8f..1cb5139 100644 --- a/.github/workflows/wdpk.yml +++ b/.github/workflows/wdpk.yml @@ -24,36 +24,37 @@ jobs: container: image: wdpk/wdpk options: -v ${{github.workspace}}/packages:/github/workspace/packages - # Steps represent a sequence of tasks that will be executed as part of the job + + strategy: + matrix: + platform: + - WDMyCloudEX4100-EX4100 + - WDMyCloudDL4100-DL4100 + - WDMyCloudEX2100-EX2100 + - WDMyCloudDL2100-DL2100 + - WDMyCloudMirror-MirrorG2 + - MyCloudEX2Ultra-EX2Ultra + - MyCloudPR4100-PR4100 + - MyCloudPR2100-PR2100 + + # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - name: Get package that was changed in the last commit id: diff - env: - use_act: ${{ secrets.USE_ACT }}" run: | - #if [ -z "${use_act}" ]; then - echo "not using act ${use_act}" - wget ${{ github.event.pull_request.diff_url }} -O pr.diff - pkg=$(grep "^\+\+\+ b/wdpk/" pr.diff | cut -d/ -f3 | uniq) - #else - # echo "$(git show)" - # pkg=$(git diff-tree --name-only --no-commit-id -r HEAD~1 | grep ^wdpk | cut -d/ -f2 | uniq || error=true) - #fi + wget ${{ github.event.pull_request.diff_url }} -O pr.diff + pkg=$(grep "^\+\+\+ b/wdpk/" pr.diff | cut -d/ -f3 | uniq) + + # concat packages into single line pkgs="" for p in $pkg; do pkgs="${pkgs}${p} " done echo "Packages: ${pkgs}" - if [ -z "${use_act}" ]; then - echo "not using act ${use_act}" - echo ::set-output name=pkg::"${pkgs}" - else - echo "using act ${use_act}" - echo "PACKAGE=${pkgs}" >> $GITHUB_ENV - fi + echo "PACKAGE=${pkgs}" >> $GITHUB_ENV # TODO: use matrix instead - name: Get platforms @@ -81,15 +82,13 @@ jobs: RELEASE_DIR="../../packages/${pkg}/OS5" mkdir -p "${RELEASE_DIR}" - echo PLF $PLATFORMS - $arr - $PACKAGE - for fullmodel in $PLATFORMS - do - model=${fullmodel%-*} - name=${fullmodel#*-} - echo "Build ${pkg} for ${platform}" - ../../mksapkg-OS5 -E -s -m $model > /dev/null - mv ../${platform}*.bin\(* ../${pkg}_${VERSION}_${name}.bin - done + echo "PLF ${{ matrix.platform }} - $arr - $PACKAGE" + fullmodel=${{ matrix.platform }} + model=${fullmodel%-*} + name=${fullmodel#*-} + echo "Build ${pkg} for ${platform}" + ../../mksapkg-OS5 -E -s -m $model > /dev/null + mv ../${platform}*.bin\(* ../${pkg}_${VERSION}_${name}.bin echo "$(ls -l ..)" - name: Upload artifacts