-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (48 loc) · 1.57 KB
/
myget-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Publish MyGet Package
on:
push:
tags:
- "v*.*.*"
run-name: Publish MyGet Package from ${{ github.ref }}
env:
DOTNET_INSTALL_DIR: "./.dotnet"
concurrency:
group: workflow-${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install protobuf
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Cache NuGet Packages
id: nuget-packages
uses: actions/cache@v4
env:
cache-name: nuget-package-cache
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-${{ env.cache-name }}
- name: Restore dependencies
run: dotnet restore
- name: Get the version from git tags
id: get_version
run: |
TAG=$(git describe --tags --abbrev=0)
VERSION=${TAG#v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build the project
run: dotnet build --configuration Release --no-restore
- name: Pack the MyGet package
run: dotnet pack --configuration Release --no-build --output ./nupkg -p:PackageVersion=${{ env.VERSION }}
- name: Publish the MyGet package
env:
MYGET_URL: ${{ secrets.MYGET_URL }}
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }}
run: dotnet nuget push ./nupkg/*.nupkg --api-key $MYGET_API_KEY --source $MYGET_URL