From 903a46805d0cabf5eb5d02a854858af9fca391a8 Mon Sep 17 00:00:00 2001 From: matias Date: Mon, 9 Oct 2023 15:16:07 -0300 Subject: [PATCH] ci: update workflows --- .github/workflows/{dotnet.yml => build.yml} | 6 ++--- .github/workflows/nuget.yml | 28 +++++++++++++++++++++ .github/workflows/release.yml | 24 +----------------- Parsec.sln | 4 ++- 4 files changed, 35 insertions(+), 27 deletions(-) rename .github/workflows/{dotnet.yml => build.yml} (89%) create mode 100644 .github/workflows/nuget.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/build.yml similarity index 89% rename from .github/workflows/dotnet.yml rename to .github/workflows/build.yml index 7b92ef02..41accb13 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,10 @@ -name: .NET +name: build and test on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 00000000..ce7a4b8c --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,28 @@ +name: release + +on: + push: + tags: + - "v*" + +jobs: + nuget: + name: Publish NuGet package + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + source-url: https://nuget.pkg.github.com/matigramirez/index.json + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and generate NuGet package + run: dotnet pack ./src/Parsec -c Release -o publish + + - name: Publish NuGet package + run: dotnet nuget push ./publish/*.nupkg --skip-duplicate --no-symbols true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a31c3d20..5563e56e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Create release and publish nuget package +name: release on: push: @@ -23,25 +23,3 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} - - nuget: - name: Publish NuGet package - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - source-url: https://nuget.pkg.github.com/matigramirez/index.json - env: - NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and generate NuGet package - run: dotnet pack ./src/Parsec -c Release -o publish - - - name: Publish NuGet package - run: dotnet nuget push ./publish/*.nupkg --skip-duplicate --no-symbols true diff --git a/Parsec.sln b/Parsec.sln index cd10afdb..7a3c2079 100644 --- a/Parsec.sln +++ b/Parsec.sln @@ -10,7 +10,9 @@ ProjectSection(SolutionItems) = preProject LICENSE = LICENSE README.md = README.md .editorconfig = .editorconfig - .github\workflows\dotnet.yml = .github\workflows\dotnet.yml + .github\workflows\build.yml = .github\workflows\build.yml + .github\workflows\nuget.yml = .github\workflows\nuget.yml + .github\workflows\release.yml = .github\workflows\release.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5BFF8B78-2976-44BE-B2BF-B954ABFF7FE2}"