Skip to content

Update documentation for use in GitHub actions (or Azure pipelines) #90

@FrankMuehlschlegel

Description

@FrankMuehlschlegel

Thank you for this awesome tool. It took me quite a little while to figure out the following little details.

  1. Escaping $ in yaml files because it is already used by the github actions (or Azure pipelines)
dotnet version patch -m "Auto increment version to v\$newVer by CI/CD pipeline" 
  1. Configure git properly before using your tool in a pipeline
git config --local user.email "your@email.com"
git config --local user.name "Your Name" 

Here is my full example script for github pipelines

name: CI/CD
env:
  DOTNET_VERSION_BACKEND: "3.1.x"
  
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  full:
    name: Build And Publish nuget
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Dotnet ${{ env.DOTNET_VERSION }}
        uses: actions/setup-dotnet@v1
        with:
            dotnet-version: ${{ env.DOTNET_VERSION }}    

      - name: Setup Tool for Version
        run: dotnet tool install -g dotnet-version-cli
      
      - name: Build
        run: dotnet build --configuration Release
  
      - name: Git config
        run: |
            git config --local user.email "your@email.com"
            git config --local user.name "Your Name"         

      - name: Increment version
        run: dotnet version -m "Auto increment version to v\$newVer by CI/CD pipeline" patch

      - name: Pack & push nuget
        run: |
            dotnet pack --configuration Release --no-build --no-restore
            dotnet nuget push bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json

      - name: Git push changes back to repo
        run: |
            git push
            git push --tags

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions