-
-
Notifications
You must be signed in to change notification settings - Fork 3
52 lines (49 loc) · 1.61 KB
/
release-template.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
name: Release Template
on:
workflow_call:
inputs:
version:
required: true
type: string
env:
NUGET_REPO_URL: "https://api.nuget.org/v3/index.json"
jobs:
CLI:
name: 🚚 Prepare new release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Sets environment variables - branch-name
uses: nelonoel/branch-name@v1.0.1
- name: Sets environment variables - Nerdbank.GitVersioning
uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Build
run: dotnet build -c Release HttpGenerator.sln -p:UseSourceLink=true -p:PackageVersion="${{ inputs.version }}" -p:Version="${{ inputs.version }}"
- name: Move packages
shell: pwsh
run: Get-ChildItem -Filter *.nupkg -Recurse | ForEach-Object { Move-Item -Path $_ -Destination . }
- name: Publish artifacts
uses: actions/upload-artifact@v3
with:
name: Packages
path: |
**/*.nupkg
README.md
- name: Push packages to NuGet
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source ${{ env.NUGET_REPO_URL }} --no-symbols
- name: Create tag
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ inputs.version }}",
sha: context.sha
})