-
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (55 loc) · 2.4 KB
/
publish.yml
File metadata and controls
70 lines (55 loc) · 2.4 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
64
65
66
67
68
69
name: Publish
on:
push:
tags:
- 'v*'
jobs:
changelog:
uses: CodingWithCalvin/.github/.github/workflows/generate-changelog.yml@main
release:
needs: changelog
runs-on: windows-latest
outputs:
version: ${{ steps.version.outputs.VERSION }}
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version from tag
id: version
run: |
$tag = "${{ github.ref_name }}"
$version = $tag -replace '^v', ''
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
echo "TAG=$tag" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Create artifacts directory
run: New-Item -ItemType Directory -Force -Path artifacts/packages
- name: Build SDK
run: dotnet build src/CodingWithCalvin.VsixSdk/CodingWithCalvin.VsixSdk.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }}
- name: Build Templates
run: dotnet pack src/CodingWithCalvin.VsixSdk.Templates/CodingWithCalvin.VsixSdk.Templates.csproj -c Release -p:Version=${{ steps.version.outputs.VERSION }}
- name: NuGet login (OIDC)
uses: nuget/login@v1
id: login
with:
user: ${{ secrets.NUGET_USERNAME }}
- name: Publish SDK to NuGet
run: dotnet nuget push artifacts/packages/CodingWithCalvin.VsixSdk.${{ steps.version.outputs.VERSION }}.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Publish Templates to NuGet
run: dotnet nuget push artifacts/packages/CodingWithCalvin.VsixSdk.Templates.${{ steps.version.outputs.VERSION }}.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.version.outputs.VERSION }}
name: v${{ steps.version.outputs.VERSION }}
body: ${{ needs.changelog.outputs.changelog }}
files: |
artifacts/packages/CodingWithCalvin.VsixSdk.${{ steps.version.outputs.VERSION }}.nupkg
artifacts/packages/CodingWithCalvin.VsixSdk.Templates.${{ steps.version.outputs.VERSION }}.nupkg