Skip to content

Commit

Permalink
Fix ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
omar committed Sep 26, 2024
1 parent 17fce5a commit 0176c12
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 43 deletions.
46 changes: 8 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,26 @@ on:
types: [published]

jobs:
test:
build:
runs-on: ubuntu-latest
name: Build
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/cache@v2
- uses: actions/setup-dotnet@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
dotnet-version: '8.x'
cache: true

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1'

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0'

- name: Install GitVersion
run: dotnet tool install -g GitVersion.Tool

- name: GitVersion
run: dotnet gitversion /l console /output buildserver

- name: DotNet Build
shell: pwsh
run: |
dotnet restore
dotnet build --no-restore
dotnet build --configuration Release --no-restore
dotnet pack --configuration Release --no-restore --no-build
- run: make build

- name: DotNet Test
shell: pwsh
run: |
dotnet test --no-build --no-restore
- run: make test

- name: Push NuGet
if: |
github.event.action == 'published'
shell: pwsh
run: dotnet nuget push **/*.nupkg --source $Env:SOURCE --api-key $Env:TOKEN
run: make push-nuget
env:
SOURCE: 'https://api.nuget.org/v3/index.json'
TOKEN: ${{ secrets.NUGET_API_KEY }}
15 changes: 10 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{
"version": "0.1.0",
"version": "2.0.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"label": "build",
"type": "shell",
"command": "dotnet",
"args": [
"build",
""
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
"problemMatcher": "$msCompile",
"group": {
"_id": "build",
"isDefault": false
}
}
]
}
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY:

build:
dotnet restore
dotnet build --no-restore
dotnet build --configuration Release --no-restore
dotnet pack --configuration Release --no-restore --no-build

test:
dotnet test --no-build --no-restore

push-nuget:
dotnet nuget push **/*.nupkg --api-key $$TOKEN --source 'https://api.nuget.org/v3/index.json'

0 comments on commit 0176c12

Please sign in to comment.