forked from lvermeulen/Bitbucket.Net
-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (48 loc) · 1.97 KB
/
Copy pathpublish.yml
File metadata and controls
63 lines (48 loc) · 1.97 KB
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
63
name: Publish to NuGet
on:
release:
types: [ published ]
# Only one publish at a time
concurrency:
group: publish
cancel-in-progress: false
permissions:
contents: read
packages: write
jobs:
publish:
name: Pack & Publish
runs-on: ubuntu-latest
timeout-minutes: 10
# Extra safety: only run on tagged releases
if: startsWith(github.event.release.tag_name, 'v')
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
# Both runtimes are required to build and test the net8.0 (LTS) and net10.0 targets.
dotnet-version: |
8.0.x
10.0.x
- name: Restore
run: dotnet restore
- name: Verify formatting
run: bash scripts/verify-format.sh --verify
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --no-build -c Release --verbosity normal
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Pack
run: dotnet pack src/Bitbucket.Net/Bitbucket.Net.csproj -c Release --no-build -o ./artifacts -p:PackageVersion=${{ steps.version.outputs.VERSION }}
- name: Push to NuGet.org
run: |
dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ./artifacts/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Push to GitHub Packages
run: |
dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/diomonogatari/index.json --skip-duplicate
dotnet nuget push ./artifacts/*.snupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/diomonogatari/index.json --skip-duplicate