Skip to content

Commit 90468e8

Browse files
[**Fixed**] NuGet Release (#3338)
* Added Nuget release when new published release * Added some comments * Removed current nuget release * Added forgotten slashes
1 parent 2bd2a45 commit 90468e8

File tree

8 files changed

+59
-96
lines changed

8 files changed

+59
-96
lines changed

.github/workflows/main.yml

+2-93
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
--source https://nuget.pkg.github.com/neo-project/index.json \
144144
--api-key "${{ secrets.GITHUB_TOKEN }}" \
145145
--disable-buffering \
146-
--no-service-endpoint;
146+
--no-service-endpoint
147147
148148
- name: Publish to myGet
149149
working-directory: ./out
@@ -152,95 +152,4 @@ jobs:
152152
--source https://www.myget.org/F/neo/api/v3/index.json \
153153
--api-key "${{ secrets.MYGET_TOKEN }}" \
154154
--disable-buffering \
155-
--no-service-endpoint;
156-
157-
Release:
158-
if: github.ref == 'refs/heads/master' && startsWith(github.repository, 'neo-project/')
159-
needs: [Test]
160-
runs-on: ubuntu-latest
161-
steps:
162-
- name: Checkout
163-
uses: actions/checkout@v4
164-
165-
- name: Get version
166-
id: get_version
167-
run: |
168-
sudo apt install xmlstarlet
169-
find src -name Directory.Build.props | xargs xmlstarlet sel -N i=http://schemas.microsoft.com/developer/msbuild/2003 -t -v "concat('::set-output name=version::v',//i:VersionPrefix/text())" | xargs echo
170-
171-
- name: Check tag
172-
id: check_tag
173-
run: curl -s -I ${{ format('https://github.com/{0}/releases/tag/{1}', github.repository, steps.get_version.outputs.version) }} | head -n 1 | cut -d$' ' -f2 | xargs printf "::set-output name=statusCode::%s" | xargs echo
174-
175-
- name: Create release
176-
if: steps.check_tag.outputs.statusCode == '404'
177-
id: create_release
178-
uses: actions/create-release@v1
179-
env:
180-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181-
with:
182-
tag_name: ${{ steps.get_version.outputs.version }}
183-
release_name: ${{ steps.get_version.outputs.version }}
184-
prerelease: ${{ contains(steps.get_version.outputs.version, '-') }}
185-
186-
- name: Setup .NET
187-
if: steps.check_tag.outputs.statusCode == '404'
188-
uses: actions/setup-dotnet@v4
189-
with:
190-
dotnet-version: ${{ env.DOTNET_VERSION }}
191-
192-
- name : Pack (Neo)
193-
if: steps.check_tag.outputs.statusCode == '404'
194-
run: |
195-
dotnet pack ./src/Neo \
196-
--configuration Release \
197-
--output ./out
198-
199-
- name : Pack (Neo.IO)
200-
if: steps.check_tag.outputs.statusCode == '404'
201-
run: |
202-
dotnet pack ./src/Neo.IO \
203-
--configuration Release \
204-
--output ./out
205-
206-
- name : Pack (Neo.Extensions)
207-
if: steps.check_tag.outputs.statusCode == '404'
208-
run: |
209-
dotnet pack ./src/Neo.Extensions \
210-
--configuration Release \
211-
--output ./out
212-
213-
- name : Pack (Neo.Json)
214-
if: steps.check_tag.outputs.statusCode == '404'
215-
run: |
216-
dotnet pack ./src/Neo.Json \
217-
--configuration Release \
218-
--output ./out
219-
220-
- name : Pack (Neo.VM)
221-
if: steps.check_tag.outputs.statusCode == '404'
222-
run: |
223-
dotnet pack ./src/Neo.VM \
224-
--configuration Release \
225-
--output ./out
226-
227-
- name : Pack (Neo.ConsoleService)
228-
if: steps.check_tag.outputs.statusCode == '404'
229-
run: |
230-
dotnet pack ./src/Neo.ConsoleService \
231-
--configuration Release \
232-
--output ./out
233-
234-
- name : Pack (Neo.Cryptography.BLS12_381)
235-
if: steps.check_tag.outputs.statusCode == '404'
236-
run: |
237-
dotnet pack ./src/Neo.Cryptography.BLS12_381 \
238-
--configuration Release \
239-
--output ./out
240-
241-
- name: Publish to NuGet
242-
if: steps.check_tag.outputs.statusCode == '404'
243-
run: |
244-
dotnet nuget push out/*.nupkg -s https://api.nuget.org/v3/index.json -k ${NUGET_TOKEN} --skip-duplicate
245-
env:
246-
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
155+
--no-service-endpoint

.github/workflows/nuget.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release (nuget)
2+
3+
# Trigger the workflow on a release event when a new release is published
4+
on:
5+
release:
6+
types: [published]
7+
8+
# Define environment variables
9+
env:
10+
DOTNET_VERSION: 8.0.x
11+
CONFIGURATION: Release
12+
13+
jobs:
14+
nuget-release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Step to set the application version from the release tag
18+
- name: Set Application Version (Environment Variable)
19+
run: |
20+
APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2)
21+
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
22+
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Setup .NET
29+
uses: actions/setup-dotnet@v4
30+
with:
31+
dotnet-version: ${{ env.DOTNET_VERSION }}
32+
33+
- name: Pack NuGet Packages
34+
run: |
35+
dotnet pack ./neo.sln \
36+
--configuration Release \
37+
--output ./sbin \
38+
--verbosity normal \ # Normal verbosity level
39+
-p:VersionPrefix=${{ env.APP_VERSION }} # Set the version prefix from tag_name
40+
41+
- name: Publish to NuGet.org
42+
run: |
43+
dotnet nuget push ./sbin/*.nupkg \
44+
--source https://api.nuget.org/v3/index.json \
45+
--api-key ${{ secrets.NUGET_TOKEN }} \
46+
--skip-duplicate

benchmarks/Directory.Build.props

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<PropertyGroup>
5+
<IsPackable>false</IsPackable>
6+
</PropertyGroup>
7+
8+
</Project>

benchmarks/Neo.Benchmarks/Neo.Benchmarks.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<TargetFrameworks>net8.0</TargetFrameworks>
66
<RootNamespace>Neo</RootNamespace>
77
<ImplicitUsings>enable</ImplicitUsings>
8-
<IsPackable>false</IsPackable>
98
</PropertyGroup>
109

1110
<ItemGroup>

benchmarks/Neo.VM.Benchmarks/Neo.VM.Benchmarks.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<RootNamespace>Neo.VM</RootNamespace>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
9-
<IsPackable>false</IsPackable>
109
</PropertyGroup>
1110

1211
<ItemGroup>

src/Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
<PropertyGroup>
55
<Copyright>2015-2024 The Neo Project</Copyright>
6-
<VersionPrefix>3.7.4</VersionPrefix>
76
<LangVersion>12.0</LangVersion>
87
<Authors>The Neo Project</Authors>
8+
<IsPackable>true</IsPackable>
99
<PackageIcon>neo.png</PackageIcon>
1010
<PackageProjectUrl>https://github.com/neo-project/neo</PackageProjectUrl>
1111
<PackageLicenseExpression>MIT</PackageLicenseExpression>

src/Neo.CLI/Neo.CLI.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<ApplicationIcon>neo.ico</ApplicationIcon>
1212
<Nullable>enable</Nullable>
1313
<OutputPath>../../bin/$(AssemblyTitle)</OutputPath>
14+
<IsPackable>false</IsPackable>
1415
</PropertyGroup>
1516

1617
<ItemGroup>

src/Neo.GUI/Neo.GUI.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<ApplicationIcon>neo.ico</ApplicationIcon>
1313
<GenerateResourceWarnOnBinaryFormatterUse>false</GenerateResourceWarnOnBinaryFormatterUse>
1414
<OutputPath>../../bin/$(AssemblyTitle)</OutputPath>
15+
<IsPackable>false</IsPackable>
1516
</PropertyGroup>
1617

1718
<ItemGroup>

0 commit comments

Comments
 (0)