I have an API in .NET Core
I'm new in Github actions and I am trying to set a github action that everytime we send a PR, it updates the API project version. I'm working with dependabot, so the idea is that everytime a package is updated, the .NET Core API version is updated too.
I tried to follow this documentation https://gitversion.net/docs/ along but I'm unable to make this work. Does someone have any idea? Much appreciated.
This is what I have so far but I get an error.
---
name: CI/CD with Dependabot
on:
pull_request:
types:
- opened
- synchronize
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version:
- 6.0.x
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Restore
run: dotnet restore "Mango.Web"
- name: Build
run: dotnet build "Mango.Web" --configuration Release --no-restore
- name: Publish
run: dotnet publish "Mango.Web" --configuration Release --no-build
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: 5.x
- name: Determine Version
id: gitversion # id to later be referenced
uses: gittools/actions/gitversion/execute@v0
- name: Publish release with GitReleaseManager
uses: gittools/actions/gitreleasemanager/publishv0
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: someOwner
tagName: 0.1.0
dependabot:
name: Dependabot fetch metadata
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-commit-verification: false
This is the error, I know it might be because gitversion not being set correctly, but that's what I saw in the documentation.
the
uses' attribute must be a path, a Docker image, or owner/repo@ref`
I tried to follow this documentation https://gitversion.net/docs/ along but I'm unable to make this work. Does someone have any idea? Much appreciated.