From 353f7c09741811fea68b027a120819eb3e9cd03e Mon Sep 17 00:00:00 2001 From: Dovrol Date: Fri, 16 Feb 2024 23:32:10 +0100 Subject: [PATCH] Added storybook publish to release workflow --- .github/workflows/release.yml | 54 ++++++++++++++----- .../AdaptiveBlazor.Storybook.csproj | 1 + 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 683ea60..2ace5cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Build and push nugets to github packages +name: Release nuget and storybook on GH Pages on: push: @@ -11,10 +11,11 @@ env: NUGET_ORG: https://api.nuget.org/v3/index.json jobs: - pack-nuget: + prepare-artifacts: runs-on: ubuntu-latest env: - PROJECT_PATH: "src/AdaptiveBlazor/AdaptiveBlazor.csproj" + PROJECT_PATH: "src/AdaptiveBlazor/AdaptiveBlazor.csproj" + STORYBOOK_PROJECT_PATH: "src/AdaptiveBlazor.Storybook/AdaptiveBlazor.Storybook.csproj" steps: - name: Checkout code uses: actions/checkout@v4 @@ -24,6 +25,9 @@ jobs: with: dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Install .NET WebAssembly Tools + run: dotnet workload install wasm-tools + - name: Setup node uses: actions/setup-node@v4 with: @@ -32,26 +36,35 @@ jobs: - name: Restore dependencies run: dotnet restore - - name: Build - run: dotnet build ${{ env.PROJECT_PATH }} --no-restore -c Release + - name: Build sln + run: dotnet build --no-restore -c Release - - name: Pack - run: dotnet pack ${{ env.PROJECT_PATH }} --no-build -c Release -o ./artifacts/packages + - name: Pack nugets + run: dotnet pack ${{ env.PROJECT_PATH }} --no-build -c Release -o ./artifacts/nugets + + - name: Generate storybook + run: dotnet publish ${{ env.STORYBOOK_PROJECT_PATH }} -c Release -o ./artifacts/storybook -p GHPages=true - name: Upload nugets as artifacts uses: actions/upload-artifact@v3 with: - name: packages - path: ./artifacts/packages + name: nugets + path: ./artifacts/nugets + + - name: Upload storybook as artifacts + uses: actions/upload-artifact@v3 + with: + name: storybook + path: ./artifacts/storybook push-to-nuget-org: - needs: pack-nuget + needs: prepare-artifacts runs-on: ubuntu-latest steps: - - name: Download packages + - name: Download nugets uses: actions/download-artifact@v3 with: - name: packages + name: nugets - name: Setup NuGet.exe uses: nuget/setup-nuget@v1 @@ -60,3 +73,20 @@ jobs: - name: Push nugets to github packages run: nuget push "*.nupkg" -ApiKey ${{ secrets.NUGET_ORG_KEY }} -Source ${{ env.NUGET_ORG }} -SkipDuplicate + + push-storybook-to-gh-pages: + needs: prepare-artifacts + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download storybook + uses: actions/download-artifact@v3 + with: + name: storybook + + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: wwwroot diff --git a/src/AdaptiveBlazor.Storybook/AdaptiveBlazor.Storybook.csproj b/src/AdaptiveBlazor.Storybook/AdaptiveBlazor.Storybook.csproj index dbff1fd..e5552e2 100644 --- a/src/AdaptiveBlazor.Storybook/AdaptiveBlazor.Storybook.csproj +++ b/src/AdaptiveBlazor.Storybook/AdaptiveBlazor.Storybook.csproj @@ -14,6 +14,7 @@ +