From aa2707d8a57d248249fed5375b18c34180d0dcbb Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sat, 23 Mar 2024 20:32:07 -0400 Subject: [PATCH] Use matrix for publish job --- .github/workflows/ci.yml | 58 ++++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7715e21..84ab515 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,23 +52,47 @@ jobs: run: cd src/MyWebLog.Tests; dotnet run -f net${{ matrix.dotnet-version }} publish: - name: Publish .zip / .bz2 Packages + name: Publish Packages runs-on: ubuntu-latest needs: build_and_test - + + strategy: + matrix: + ver: + - "net6.0" + - "net7.0" + - "net8.0" + os: + - "linux-x64" + - "win-x64" + include: + - os: "linux-x64" + bz2: true + - os: "win-x64" + zip: true steps: - - name: Check Out Code - uses: actions/checkout@v4 - - name: Setup .NET Core SDK - uses: actions/setup-dotnet@v4.0.0 - with: - dotnet-version: 8.x - - name: Create Release Packages - run: dotnet run build.fsproj CI - - name: Upload Artifacts - uses: actions/upload-artifact@v4 - with: - name: release-packages - path: | - release/*x64.zip - release/*.bz2 + - name: Check Out Code + uses: actions/checkout@v4 + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v4.0.0 + with: + dotnet-version: 8.x + - name: Publish (Release) + run: dotnet publish -c Release -f ${{ matrix.ver }} -r ${{ matrix.os }} src/MyWebLog/MyWebLog.fsproj + - name: Zip Admin Theme + run: cd src/admin-theme; zip -r ../MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish/admin-theme.zip *; cd ../.. + - name: Zip Default Theme + run: cd src/default-theme; zip -r ../MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish/default-theme.zip *; cd ../.. + - if: ${{ matrix.bz2 }} + name: Create .tar.bz2 Archive + run: tar cfj myWebLog-${{ matrix.ver }}-${{ matrix.os }}.tar.bz2 -C src/MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish . + - if: ${{ matrix.zip }} + name: Create .zip Archive + run: cd src/MyWebLog/bin/Release/${{ matrix.ver }}/${{ matrix.os }}/publish; zip -r myWebLog-${{ matrix.ver }}-${{ matrix.os }}.zip *; cp myWeb*.zip ../../../../../../..; cd ../../../../../../.. + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: release-packages + path: | + *x64.zip + *.bz2