Skip to content

Fix git version environment problem #75

Fix git version environment problem

Fix git version environment problem #75

Workflow file for this run

name: dotnet
on:
push:
branches: [ main ]
tags: ["*"]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.x"
- id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- run: |
dotnet pack \
--include-source \
--include-symbols \
--configuration Release \
--no-build \
--no-restore \
-p:PackageVersion="${{ env.GitVersion_FullSemVer }}" \
RegExtract/RegExtract.csproj \
--output ${{ github.workspace }}/nugets/
- uses: actions/upload-artifact@v2
with:
name: nugets
path: nugets
nuget-push-dev:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: build
steps:
- name: download artifact
uses: actions/download-artifact@v2
with:
name: nugets
- name: setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
source-url: https://nuget.pkg.github.com/sblom/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: nuget push
run: dotnet nuget push *.nupkg *.snupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }}
nuget-push-prod:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: build
steps:
- uses: actions/download-artifact@v2
with:
name: nugets
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
- run: dotnet nuget push *.nupkg *.snupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }}