dotnet-version-cli
dotnet-version-cli copied to clipboard
Update documentation for use in GitHub actions (or Azure pipelines)
Thank you for this awesome tool. It took me quite a little while to figure out the following little details.
- 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"
- Configure git properly before using your tool in a pipeline
git config --local user.email "[email protected]"
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 "[email protected]"
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
@FluentChange thanks for this. I'll make an update, or, feel free to submit a PR with the documentation.