Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump up dotnet 8.0 #7

Merged
merged 2 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 4 additions & 126 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,147 +9,25 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
dotnet-version: [7.0.x]
dotnet-version: [8.0.x]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
NUGET_XMLDOC_MODE: skip

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v1
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.nuget/packages
key: nuget-${{ matrix.os }}-${{ matrix.dotnet-version }}
restore-keys: |
nuget-${{ matrix.os }}-
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Test
working-directory: ./noc/Test
run: dotnet test --verbosity normal -c Debug

dotnet-publish:
if: contains(github.ref, 'tags/v')
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
dotnet-version: [7.0.x]
runs-on: ${{ matrix.os }}
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
NUGET_XMLDOC_MODE: skip
steps:
- name: vars
id: vars
shell: bash
run: |
echo ::set-output name=version::${TAG_REF_NAME##*/v}
echo ::set-output name=runtime_id::"$(echo ${{ matrix.os }} | sed 's/windows/win/;s/ubuntu/linux/;s/macOS/osx/;s/latest/x64/')"
env:
TAG_REF_NAME: ${{ github.ref }}

- uses: actions/checkout@v3

- uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.nuget/packages
key: nuget-${{ matrix.os }}-${{ matrix.dotnet-version }}
restore-keys: |
nuget-${{ matrix.os }}-

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: dotnet publish
working-directory: ./noc/noc
run: |
dotnet publish -c Release -r ${{ steps.vars.outputs.runtime_id }} --self-contained true -p:Version=${{ steps.vars.outputs.version }} -o ${{ steps.vars.outputs.runtime_id }}

- name: Upload build result
uses: actions/upload-artifact@v1
with:
name: ${{ steps.vars.outputs.runtime_id }}
path: noc/noc/${{ steps.vars.outputs.runtime_id }}

create-releases:
name: Create GitHub Release
if: contains(github.ref, 'tags/v')
needs: [test, dotnet-publish]
runs-on: ubuntu-latest
steps:
- name: vars
id: vars
shell: bash
run: |
echo ::set-output name=version::${TAG_REF_NAME##*/}
env:
TAG_REF_NAME: ${{ github.ref }}

- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.vars.outputs.version }}
release_name: Release ${{ steps.vars.outputs.version }}
draft: false
prerelease: false

- name: Output Release URL File
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt

- name: Save Release URL File for publish
uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt

upload-release:
name: Upload artifacts to GitHub Release
if: contains(github.ref, 'tags/v')
strategy:
matrix:
runtime_id: [win-x64, linux-x64, osx-x64]
runs-on: ubuntu-latest
needs: [dotnet-publish, create-releases, test]
steps:
- uses: actions/download-artifact@v2
with:
name: ${{ matrix.runtime_id }}
path: ${{ matrix.runtime_id }}

- uses: actions/download-artifact@v2
with:
name: release_url

- name: Get Release Info
id: get_release_info
shell: bash
run: |
echo ::set-output name=file_name::${REPOSITORY_NAME##*/}-${TAG_REF_NAME##*/v}
echo ::set-output name=upload_url::"$(cat release_url.txt)"
echo ::set-output name=version::${TAG_REF_NAME##*/v}
env:
TAG_REF_NAME: ${{ github.ref }}
REPOSITORY_NAME: ${{ github.repository }}

- name: zip
run: |
zip -r ${{ matrix.runtime_id }} ${{ matrix.runtime_id }}
- name: Upload assets to GitHub Release
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./${{ matrix.runtime_id }}.zip
asset_name: ${{ steps.get_release_info.outputs.file_name }}-${{ matrix.runtime_id }}.zip
asset_content_type: application/zip
4 changes: 3 additions & 1 deletion noc/Test/Test.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>

<LangVersion>12</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion noc/noc/noc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<Version>1.2</Version>
<PackageLicenseUrl />
Expand All @@ -12,6 +12,7 @@
<Product />
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
<LangVersion>12</LangVersion>
</PropertyGroup>

</Project>