-
-
Notifications
You must be signed in to change notification settings - Fork 39
112 lines (109 loc) · 5.76 KB
/
release.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
name: "Release DisCatSharp"
on:
workflow_dispatch:
inputs:
version_suffix:
description: "Version Suffix"
required: false
type: string
release_as_prerelease:
description: "Release as pre-release"
required: true
type: boolean
default: true
confirm_full_release:
description: "Confirm that you want to release as a full release"
required: false
type: boolean
default: false
packages_to_release:
description: "Packages to release"
required: false
type: choice
default: "DisCatSharp"
options:
- "DisCatSharp"
- "DisCatSharp.Attributes"
# - "DisCatSharp.Tools" # This does not work currently
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
jobs:
release:
timeout-minutes: 15
runs-on: ubuntu-latest
name: Build library and release
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check Intention
if: ${{!inputs.release_as_prerelease}}
run: |
if [ "${{ inputs.confirm_full_release }}" = "false" ]; then
echo "Full release not confirmed, exiting."
exit 1
fi
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: |
9.x
8.x
- name: Restore dependencies (DisCatSharp)
if: ${{ github.event.inputs.packages_to_release == 'DisCatSharp' }}
run: dotnet restore --no-cache -f -v minimal DisCatSharp.sln
- name: Restore dependencies (DisCatSharp.Attributes)
if: ${{ github.event.inputs.packages_to_release == 'DisCatSharp.Attributes' }}
run: dotnet restore --no-cache -f -v minimal DisCatSharp.Attributes/DisCatSharp.Attributes.csproj
- name: Restore dependencies (DisCatSharp.Tools)
if: ${{ github.event.inputs.packages_to_release == 'DisCatSharp.Tools' }}
run: dotnet restore --no-cache -f -v minimal DisCatSharp.Tools/DisCatSharp.Tools.sln
- name: Build DisCatSharp as full release
if: ${{!inputs.release_as_prerelease && github.event.inputs.packages_to_release == 'DisCatSharp'}}
shell: pwsh
run: ./DisCatSharp.Tools/rebuild-lib.ps1 -ArtifactLocation ./dcs-artifacts -Configuration Release
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: Build DisCatSharp as pre-release
if: ${{inputs.release_as_prerelease && github.event.inputs.packages_to_release == 'DisCatSharp'}}
shell: pwsh
run: ./DisCatSharp.Tools/rebuild-lib.ps1 -ArtifactLocation ./dcs-artifacts -Configuration Release -VersionSuffix ${{github.event.inputs.version_suffix}}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: Build DisCatSharp.Attributes as full release
if: ${{!inputs.release_as_prerelease && github.event.inputs.packages_to_release == 'DisCatSharp.Attributes'}}
shell: pwsh
run: ./DisCatSharp.Tools/rebuild-attributes.ps1 -ArtifactLocation ./dcs-artifacts -Configuration Release
- name: Build DisCatSharp.Attributes as pre-release
if: ${{inputs.release_as_prerelease && github.event.inputs.packages_to_release == 'DisCatSharp.Attributes'}}
shell: pwsh
run: ./DisCatSharp.Tools/rebuild-attributes.ps1 -ArtifactLocation ./dcs-artifacts -Configuration Release -VersionSuffix ${{github.event.inputs.version_suffix}}
- name: Build DisCatSharp.Tools as full release
if: ${{!inputs.release_as_prerelease && github.event.inputs.packages_to_release == 'DisCatSharp.Tools'}}
shell: pwsh
run: ./DisCatSharp.Tools/rebuild-tools.ps1 -ArtifactLocation ./dcs-artifacts -Configuration Release
- name: Build DisCatSharp.Tools as pre-release
if: ${{inputs.release_as_prerelease && github.event.inputs.packages_to_release == 'DisCatSharp.Tools'}}
run: ./DisCatSharp.Tools/rebuild-tools.ps1 -ArtifactLocation ./dcs-artifacts -Configuration Release -VersionSuffix ${{github.event.inputs.version_suffix}}
- name: Remove invalid packages
if: ${{ github.event.inputs.packages_to_release == 'DisCatSharp' }}
shell: pwsh
run: rm *.symbols.*
working-directory: ./dcs-artifacts
- name: Publish to NuGet
shell: pwsh
run: dotnet nuget push --source https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} * --skip-duplicate
working-directory: ./dcs-artifacts
- name: Publish to GitHub Packages
shell: pwsh
run: dotnet nuget push --source https://nuget.pkg.github.com/Aiko-IT-Systems/index.json -k ${{secrets.NYUW_TOKEN_GH}} *
working-directory: ./dcs-artifacts