-
Notifications
You must be signed in to change notification settings - Fork 27
96 lines (81 loc) · 2.69 KB
/
deploy.yml
File metadata and controls
96 lines (81 loc) · 2.69 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
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
name: Build and Release ESI.NET
on:
push:
tags:
- '*.*.*'
workflow_dispatch:
inputs:
manual_tag:
description: 'Version tag (example 2025.1.1 (<year>.<month>.<integer++>)'
required: true
jobs:
build:
runs-on: ubuntu-latest
env:
BUILD_PLATFORM: 'Any CPU'
BUILD_CONFIGURATION: 'Release'
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.x'
- name: Extract version from tag or input
id: get_version
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.manual_tag }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: |
dotnet build ESI.NET.sln --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore
- name: Create Package
shell: bash
run: |
dotnet pack ESI.NET/ESI.NET.csproj \
--configuration ${{ env.BUILD_CONFIGURATION }} \
--output ./nupkgs \
-p:PackageVersion=${{ steps.get_version.outputs.version }}
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: ./nupkgs/*.nupkg
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: nuget-package
- name: Push to NuGet.org
run: |
dotnet nuget push "nupkgs/*.nupkg" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.manual_tag || github.ref_name }}
name: ESI.NET ${{ needs.build.outputs.version }}
body: |
Release for version ${{ needs.build.outputs.version }}.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Send Discord Webhook
if: success()
env:
DISCORD_WEBHOOK: ${{ github.event_name == 'workflow_dispatch' && secrets.DISCORD_TEST_WEBHOOK_URL || secrets.DISCORD_WEBHOOK_URL }}
uses: Ilshidur/action-discord@0.3.2
with:
args: |
**ESI.NET ${{ needs.build.outputs.version }} NuGet package released**