Skip to content

Commit

Permalink
Use actions matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaang committed Nov 28, 2020
1 parent e310c92 commit a56e698
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions .github/workflows/wdpk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a56e698

Please sign in to comment.