From 4f607c568961a1ecb8e1aeff91730d6df77569a1 Mon Sep 17 00:00:00 2001 From: Oleg-Mozhey <93147982+Oleg-Mozhey@users.noreply.github.com> Date: Fri, 21 Feb 2025 15:01:09 +0400 Subject: [PATCH 1/9] Create release-playwright-bdd --- .github/workflows/release-playwright-bdd | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/release-playwright-bdd diff --git a/.github/workflows/release-playwright-bdd b/.github/workflows/release-playwright-bdd new file mode 100644 index 00000000..5b69f9b7 --- /dev/null +++ b/.github/workflows/release-playwright-bdd @@ -0,0 +1,45 @@ +name: Release BDD nugets + +on: + workflow_dispatch: + +jobs: + build_application: + runs-on: ubuntu-latest + env: + DOTNET_NOLOGO: true + steps: + - name: checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.0.x' + include-prerelease: true + - name: restore packages + run: dotnet restore + - name: build + run: dotnet build -c Release --no-restore + - name: Get version + run: | + export VER=$(grep -oP '\d+\.\d+\.\d+(?=)' Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj) + echo "VER=$VER" >> $GITHUB_ENV + echo $VER + - name: Package app + run: | + dotnet pack ./Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj \ + --configuration Release /p:Platform=\"AnyCPU\" \ + /p:PackageVersion=${{ env.VER }} --output ./ + - name: Create Release + uses: ncipollo/release-action@v1 + with: + tag: ${{ env.VER }} + artifacts: "Behavioral.Automation.${{ env.VER }}.nupkg" + bodyFile: "Behavioral.Automation.Selenium/CHANGELOG.md" + token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish app into nuget.org + env: + NUGET_API_KEY: ${{ secrets.QUANTORI_NUGET_API_KEY }} + run: dotnet nuget push ./Behavioral.Automation.${{ env.VER }}.nupkg -s "https://api.nuget.org/v3/index.json" -k "$NUGET_API_KEY" --skip-duplicate From 65a92e0765ff046d873302c9085583aabfabfffd Mon Sep 17 00:00:00 2001 From: OlegMozhey Date: Fri, 7 Mar 2025 13:47:49 +0400 Subject: [PATCH 2/9] update BDD GHA release workflow --- .../workflows/{release-playwright-bdd => ReleaseBddNew.yaml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{release-playwright-bdd => ReleaseBddNew.yaml} (95%) diff --git a/.github/workflows/release-playwright-bdd b/.github/workflows/ReleaseBddNew.yaml similarity index 95% rename from .github/workflows/release-playwright-bdd rename to .github/workflows/ReleaseBddNew.yaml index 5b69f9b7..2a852fb9 100644 --- a/.github/workflows/release-playwright-bdd +++ b/.github/workflows/ReleaseBddNew.yaml @@ -14,9 +14,9 @@ jobs: with: fetch-depth: 0 - name: setup dotnet - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.x' + dotnet-version: '8.0.x' include-prerelease: true - name: restore packages run: dotnet restore From 461891f2e0aeb4dc160537e0c0026a78d0421172 Mon Sep 17 00:00:00 2001 From: OlegMozhey Date: Fri, 7 Mar 2025 14:13:11 +0400 Subject: [PATCH 3/9] test --- .github/workflows/ReleaseBddNew.yaml | 83 +++++++++++++++++----------- 1 file changed, 51 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ReleaseBddNew.yaml b/.github/workflows/ReleaseBddNew.yaml index 2a852fb9..4eb857d5 100644 --- a/.github/workflows/ReleaseBddNew.yaml +++ b/.github/workflows/ReleaseBddNew.yaml @@ -1,45 +1,64 @@ name: Release BDD nugets on: - workflow_dispatch: + push: + tags: + - 'async-abstractions-ui-v*' + branch: + - 'BAP-139-automatic-publication-for-playwright-part' jobs: build_application: runs-on: ubuntu-latest - env: - DOTNET_NOLOGO: true steps: - name: checkout uses: actions/checkout@v2 with: fetch-depth: 0 - - name: setup dotnet - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - include-prerelease: true - - name: restore packages - run: dotnet restore - - name: build - run: dotnet build -c Release --no-restore - - name: Get version - run: | - export VER=$(grep -oP '\d+\.\d+\.\d+(?=)' Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj) - echo "VER=$VER" >> $GITHUB_ENV - echo $VER - - name: Package app + + - name: Extract Version and Project Name + id: version run: | - dotnet pack ./Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj \ - --configuration Release /p:Platform=\"AnyCPU\" \ - /p:PackageVersion=${{ env.VER }} --output ./ - - name: Create Release - uses: ncipollo/release-action@v1 - with: - tag: ${{ env.VER }} - artifacts: "Behavioral.Automation.${{ env.VER }}.nupkg" - bodyFile: "Behavioral.Automation.Selenium/CHANGELOG.md" - token: ${{ secrets.GITHUB_TOKEN }} - - name: Publish app into nuget.org - env: - NUGET_API_KEY: ${{ secrets.QUANTORI_NUGET_API_KEY }} - run: dotnet nuget push ./Behavioral.Automation.${{ env.VER }}.nupkg -s "https://api.nuget.org/v3/index.json" -k "$NUGET_API_KEY" --skip-duplicate + TAG_NAME=${{ github.ref_name }} + if [[ "$TAG_NAME" =~ ^async-abstractions-ui-v([0-9]+\.[0-9]+)$ ]]; then + PROJECT_PATH="Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj" + PACKAGE_VERSION="${BASH_REMATCH[1]}" + else + echo "Unknown tag format: $TAG_NAME" + exit 1 + fi + + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + echo "PROJECT_PATH=$PROJECT_PATH" >> $GITHUB_ENV + echo "Detected Version: $PACKAGE_VERSION for project $PROJECT_PATH" + +# - name: setup dotnet +# uses: actions/setup-dotnet@v4 +# with: +# dotnet-version: '8.0.x' +# include-prerelease: true +# - name: restore packages +# run: dotnet restore +# - name: build +# run: dotnet build -c Release --no-restore +# - name: Get version +# run: | +# export VER=$(grep -oP '\d+\.\d+\.\d+(?=)' Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj) +# echo "VER=$VER" >> $GITHUB_ENV +# echo $VER +# - name: Package app +# run: | +# dotnet pack ./Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj \ +# --configuration Release /p:Platform=\"AnyCPU\" \ +# /p:PackageVersion=${{ env.VER }} --output ./ +# - name: Create Release +# uses: ncipollo/release-action@v1 +# with: +# tag: ${{ env.VER }} +# artifacts: "Behavioral.Automation.${{ env.VER }}.nupkg" +# bodyFile: "Behavioral.Automation.Selenium/CHANGELOG.md" +# token: ${{ secrets.GITHUB_TOKEN }} +# - name: Publish app into nuget.org +# env: +# NUGET_API_KEY: ${{ secrets.QUANTORI_NUGET_API_KEY }} +# run: dotnet nuget push ./Behavioral.Automation.${{ env.VER }}.nupkg -s "https://api.nuget.org/v3/index.json" -k "$NUGET_API_KEY" --skip-duplicate From 6fb341e312ce448ac06ef4c732145993b3b80d21 Mon Sep 17 00:00:00 2001 From: OlegMozhey Date: Fri, 7 Mar 2025 14:16:20 +0400 Subject: [PATCH 4/9] test --- .github/workflows/ReleaseBddNew.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ReleaseBddNew.yaml b/.github/workflows/ReleaseBddNew.yaml index 4eb857d5..c635f901 100644 --- a/.github/workflows/ReleaseBddNew.yaml +++ b/.github/workflows/ReleaseBddNew.yaml @@ -4,8 +4,8 @@ on: push: tags: - 'async-abstractions-ui-v*' - branch: - - 'BAP-139-automatic-publication-for-playwright-part' + branches: + - BAP-139-automatic-publication-for-playwright-part jobs: build_application: From 59fb32bd19edab7bcf7983bf2112c52e4a104a4d Mon Sep 17 00:00:00 2001 From: OlegMozhey Date: Fri, 7 Mar 2025 14:18:52 +0400 Subject: [PATCH 5/9] test --- .github/workflows/ReleaseBddNew.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ReleaseBddNew.yaml b/.github/workflows/ReleaseBddNew.yaml index c635f901..f0ba63d8 100644 --- a/.github/workflows/ReleaseBddNew.yaml +++ b/.github/workflows/ReleaseBddNew.yaml @@ -5,7 +5,7 @@ on: tags: - 'async-abstractions-ui-v*' branches: - - BAP-139-automatic-publication-for-playwright-part + - 'BAP-139-automatic-publication-for-playwright-part-v*' jobs: build_application: @@ -23,6 +23,9 @@ jobs: if [[ "$TAG_NAME" =~ ^async-abstractions-ui-v([0-9]+\.[0-9]+)$ ]]; then PROJECT_PATH="Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj" PACKAGE_VERSION="${BASH_REMATCH[1]}" + elif [[ "$TAG_NAME" =~ ^BAP-139-automatic-publication-for-playwright-part-v([0-9]+\.[0-9]+)$ ]]; then + PROJECT_PATH="Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj" + PACKAGE_VERSION="${BASH_REMATCH[1]}" else echo "Unknown tag format: $TAG_NAME" exit 1 From 162c299b18434a1a7134ec26586feb669a67c07a Mon Sep 17 00:00:00 2001 From: OlegMozhey Date: Fri, 7 Mar 2025 14:24:56 +0400 Subject: [PATCH 6/9] spicify patch release in tag --- .github/workflows/ReleaseBddNew.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ReleaseBddNew.yaml b/.github/workflows/ReleaseBddNew.yaml index f0ba63d8..1b1eb891 100644 --- a/.github/workflows/ReleaseBddNew.yaml +++ b/.github/workflows/ReleaseBddNew.yaml @@ -1,10 +1,13 @@ name: Release BDD nugets +# First GHA file - publish only from tag, specify all attributes +# Next GHA workflow - publish patch releases automatically + on: push: tags: - 'async-abstractions-ui-v*' - branches: + branches: # should be semver major.minor.patch - 'BAP-139-automatic-publication-for-playwright-part-v*' jobs: @@ -20,10 +23,10 @@ jobs: id: version run: | TAG_NAME=${{ github.ref_name }} - if [[ "$TAG_NAME" =~ ^async-abstractions-ui-v([0-9]+\.[0-9]+)$ ]]; then + if [[ "$TAG_NAME" =~ ^async-abstractions-ui-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then PROJECT_PATH="Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj" PACKAGE_VERSION="${BASH_REMATCH[1]}" - elif [[ "$TAG_NAME" =~ ^BAP-139-automatic-publication-for-playwright-part-v([0-9]+\.[0-9]+)$ ]]; then + elif [[ "$TAG_NAME" =~ ^BAP-139-automatic-publication-for-playwright-part-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then PROJECT_PATH="Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj" PACKAGE_VERSION="${BASH_REMATCH[1]}" else From ad86ca4b0b99a74741ae78491efe1356a31f5c18 Mon Sep 17 00:00:00 2001 From: OlegMozhey Date: Fri, 7 Mar 2025 14:30:57 +0400 Subject: [PATCH 7/9] styling --- .github/workflows/ReleaseBddNew.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ReleaseBddNew.yaml b/.github/workflows/ReleaseBddNew.yaml index 1b1eb891..07c57fab 100644 --- a/.github/workflows/ReleaseBddNew.yaml +++ b/.github/workflows/ReleaseBddNew.yaml @@ -11,7 +11,7 @@ on: - 'BAP-139-automatic-publication-for-playwright-part-v*' jobs: - build_application: + get_project_and_version_from_tag: runs-on: ubuntu-latest steps: - name: checkout @@ -24,10 +24,10 @@ jobs: run: | TAG_NAME=${{ github.ref_name }} if [[ "$TAG_NAME" =~ ^async-abstractions-ui-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then - PROJECT_PATH="Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj" + PROJECT_PATH="Behavioral.Automation.AsyncAbstractions.UI/Behavioral.Automation.AsyncAbstractions.UI.csproj" PACKAGE_VERSION="${BASH_REMATCH[1]}" elif [[ "$TAG_NAME" =~ ^BAP-139-automatic-publication-for-playwright-part-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then - PROJECT_PATH="Behavioral.Automation.Selenium/Behavioral.Automation/Behavioral.Automation.csproj" + PROJECT_PATH="Behavioral.Automation.AsyncAbstractions.UI/Behavioral.Automation.AsyncAbstractions.UI.csproj" PACKAGE_VERSION="${BASH_REMATCH[1]}" else echo "Unknown tag format: $TAG_NAME" From 27ae4fb7e99ade414d90f10348cf2f0cf50eca73 Mon Sep 17 00:00:00 2001 From: OlegMozhey Date: Fri, 7 Mar 2025 15:43:27 +0400 Subject: [PATCH 8/9] Add reusable workflow --- .github/workflows/PlaywrightProjectTests.yml | 11 +++-------- .github/workflows/RunBlazorApp.yml | 13 +++++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/RunBlazorApp.yml diff --git a/.github/workflows/PlaywrightProjectTests.yml b/.github/workflows/PlaywrightProjectTests.yml index e778fec9..a477ac51 100644 --- a/.github/workflows/PlaywrightProjectTests.yml +++ b/.github/workflows/PlaywrightProjectTests.yml @@ -3,6 +3,7 @@ name: Playwright project tests on: workflow_dispatch: pull_request: + workflow_call: jobs: PlaywrightProjectTests: @@ -13,11 +14,5 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: '5.0.x' - - name: Run Blazor app - run: | - cd ./src/BlazorApp - dotnet run & - - name: Test Blazor app - run: | - cd ./Behavioral.Automation.Playwright/UITests - dotnet test + call-workflow-1-in-local-repo: + uses: ./.github/workflows/RunBlazorApp.yml diff --git a/.github/workflows/RunBlazorApp.yml b/.github/workflows/RunBlazorApp.yml new file mode 100644 index 00000000..9ccab71a --- /dev/null +++ b/.github/workflows/RunBlazorApp.yml @@ -0,0 +1,13 @@ +name: Playwright project tests + +on: + workflow_call: + +jobs: + RunBlazorApp: + runs-on: ubuntu-latest + steps: + - name: Run Blazor app + run: | + cd ./src/BlazorApp + dotnet run & From 606599f75a7c153927c340caceb362bfe3fc6a21 Mon Sep 17 00:00:00 2001 From: OlegMozhey Date: Fri, 7 Mar 2025 15:46:30 +0400 Subject: [PATCH 9/9] add reusable workflow --- .github/workflows/PlaywrightProjectTests.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/PlaywrightProjectTests.yml b/.github/workflows/PlaywrightProjectTests.yml index c5dba6d0..bbbac1d0 100644 --- a/.github/workflows/PlaywrightProjectTests.yml +++ b/.github/workflows/PlaywrightProjectTests.yml @@ -14,11 +14,5 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: '8.0.x' - - name: Run Blazor app - run: | - cd ./src/BlazorApp - dotnet run & - - name: Test Blazor app - run: | - cd ./Behavioral.Automation.Playwright/UITests - dotnet test + call-workflow-1-in-local-repo: + uses: ./.github/workflows/RunBlazorApp.yml