-
Notifications
You must be signed in to change notification settings - Fork 248
126 lines (108 loc) · 3.85 KB
/
deploy-package.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: "deploy"
run-name: Deploy NuGet package
concurrency:
group: azure-artifacts
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
environment:
description: Deployment environment
type: choice
options:
- azure-artifacts
- nuget
default: azure-artifacts
required: true
preview:
description: Append preview suffix
type: boolean
default: true
required: true
jobs:
build:
runs-on: ubuntu-latest
outputs:
nuget-version: "${{ steps.gitversion.outputs.majorMinorPatch }}-preview-${{ github.run_id }}"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: "5.x"
preferLatestVersion: true
- name: Determine version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
updateAssemblyInfo: true
useConfigFile: true
configFilePath: gitversion.yml
- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "7.x"
dotnet-quality: "ga"
- name: Build library
run: >
dotnet build src/Indicators.csproj
--configuration Release
--property:Version="${{ steps.gitversion.outputs.majorMinorPatch }}-preview-${{ github.run_id }}"
--property:ContinuousIntegrationBuild=true
-warnAsError
- name: Pack for NuGet
run: >
dotnet pack src/Indicators.csproj
--configuration Release
--no-build
--include-symbols
--output NuGet
-p:PackageVersion="${{ steps.gitversion.outputs.majorMinorPatch }}-preview-${{ github.run_id }}"
- name: Save NuGet package
uses: actions/upload-artifact@v3
with:
name: packages
path: NuGet
- name: Show version
run: |
{
echo "### Identified semantic version"
echo "| Variable | Value |"
echo "| --------------- | ----------------------------------------------- |"
echo "| Major | ${{ steps.gitversion.outputs.major }} |"
echo "| Minor | ${{ steps.gitversion.outputs.minor }} |"
echo "| Patch | ${{ steps.gitversion.outputs.patch }} |"
echo "| MajorMinorPatch | ${{ steps.gitversion.outputs.majorMinorPatch }} |"
echo ""
echo "Composed version: ${{ steps.gitversion.outputs.majorMinorPatch }}-preview-${{ github.run_id }}"
} >> $GITHUB_STEP_SUMMARY
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
url: "${{ vars.NUGET_DOWNLOAD_PREFIX }}${{ needs.build.outputs.nuget-version }}"
steps:
- name: Install NuGet tool
uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_TOKEN }}
nuget-version: '6.0.x'
- name: Download NuGet package
uses: actions/download-artifact@v3
with:
name: packages
path: NuGet
- name: Show publish preview
run: |
echo ${{ vars.NUGET_PUBLISH_URL }}
echo ${{ vars.NUGET_DOWNLOAD_PREFIX }}
echo "skender.stock.indicators.${{ needs.build.outputs.nuget-version }}.nupkg"
echo "skender.stock.indicators.${{ needs.build.outputs.nuget-version }}.snupkg"
- name: Publish packages
run: |
nuget sources Add -Name "PubURL" -Source ${{ vars.NUGET_PUBLISH_URL }} -UserName DaveSkender -Password ${{ secrets.NUGET_TOKEN }}
nuget push NuGet/*.nupkg -src PubURL -ApiKey AZ