From 3dea18d285b311c994f2398d99c43fdc59504617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Wei=C3=9F?= <72068105+Sandoun@users.noreply.github.com> Date: Fri, 16 Jun 2023 11:18:08 +0200 Subject: [PATCH] Speperated test and publish pipeline --- .github/workflows/publish-pipeline.yml | 44 +++++++++++++++++++ .../{build-pipeline.yml => test-pipeline.yml} | 32 +------------- 2 files changed, 46 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/publish-pipeline.yml rename .github/workflows/{build-pipeline.yml => test-pipeline.yml} (54%) diff --git a/.github/workflows/publish-pipeline.yml b/.github/workflows/publish-pipeline.yml new file mode 100644 index 0000000..f9286aa --- /dev/null +++ b/.github/workflows/publish-pipeline.yml @@ -0,0 +1,44 @@ +name: Publish pipeline + +on: + workflow_dispatch: + release: + types: [published] + +permissions: write-all +jobs: + + test-pipeline: + name: 'Invoke the test pipeline' + uses: ./.github/workflows/test-pipeline.yml + secrets: inherit + + #Deploy package + publish-package: + name: 'Build and publish package' + needs: test-pipeline + runs-on: [self-hosted, linux, x64, womed-local-linux] + steps: + - uses: actions/checkout@v3 + + - name: Set .csproj version to ${{github.ref_name}} + run: sed -i "s/\(\([0-9]\+\.\)\{2\}\)\([0-9]\+\)/\1${{github.ref_name}}/" MewtocolNet/MewtocolNet.csproj + + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: '6.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build "MewtocolNet" + + - name: Pack + run: dotnet pack "MewtocolNet" + + - name: Publish + run: | + cd '${{ github.workspace }}/Builds' + dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/WOmed/index.json" diff --git a/.github/workflows/build-pipeline.yml b/.github/workflows/test-pipeline.yml similarity index 54% rename from .github/workflows/build-pipeline.yml rename to .github/workflows/test-pipeline.yml index 9291bc6..cb3ffb3 100644 --- a/.github/workflows/build-pipeline.yml +++ b/.github/workflows/test-pipeline.yml @@ -1,4 +1,4 @@ -name: Build pipeline +name: Test pipeline on: workflow_dispatch: @@ -46,32 +46,4 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - #Deplay package - publish-package: - name: 'Build and publish package' - needs: [run-unit-tests, ] - runs-on: [self-hosted, linux, x64, womed-local-linux] - steps: - - uses: actions/checkout@v3 - - - name: Setup .NET - uses: actions/setup-dotnet@v2 - with: - dotnet-version: '6.0.x' - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build "MewtocolNet" - - - name: Pack - run: dotnet pack "MewtocolNet" - - - name: Publish - run: | - cd '${{ github.workspace }}/Builds' - dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/WOmed/index.json" - #dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.NUGET_KEY }} --source "https://api.nuget.org" + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file