Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanV2 committed Dec 24, 2023
2 parents 0c958ef + ba9e2d5 commit 49d7e69
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
continue-on-error: true
run: |
cd $GITHUB_WORKSPACE
git config --global user.email "github-action@github.com"
git config --global user.email "actions@github.com"
git config --global user.name "github"
git add .
git commit -m "auto: Generated Readmes"
git commit -m "auto: Generated Readmes" || echo "No changes to commit"
- name: 🚚 Push
continue-on-error: true
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/dotnet-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: .NET 📋 Unit test
name: 📋 .NET Unit test

on:
push:
branches: [ "main" ]
branches:
- main
pull_request:

concurrency:
Expand Down
49 changes: 43 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: 📦 Nuget Release

on:
release:
types: [created]
workflow_dispatch: {}
push:
tags:
- '*'

concurrency:
group: publish-${{ github.ref }}
Expand All @@ -13,8 +13,45 @@ env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

jobs:
update-version:
name: 📝 Update version
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.tag.outputs.tag_name }}
steps:
- name: 📦 Checkout repository
uses: actions/checkout@v3
with:
ref: main

- name: 🔍 Get Tag
id: tag
run: echo "tag_name=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"

- name: 🖊️ Update version in .csproj files
run: |
TAG=${{ steps.tag.outputs.tag_name }}
find . -name '*.csproj' -type f -exec sed -i "s/<Version>.*<\/Version>/<Version>${TAG//v}<\/Version>/g" {} \;
- name: 📋 Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "auto: Update version to ${{ steps.tag.outputs.tag_name }}" || echo "No changes to commit"
- name: 🚚 Push changes
continue-on-error: true
run: git push

- name: 🖊️ Job summary
run: |
echo "Tag name: ${{ steps.tag.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY
build:
name: 🛠️ Build
runs-on: windows-latest
needs: update-version
permissions:
packages: write
contents: read
Expand All @@ -24,14 +61,15 @@ jobs:
steps:
- name: 📦 Checkout repository
uses: actions/checkout@v3
with:
ref: main

- name: 🛠️ Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
7.0.x
8.0.x
source-url: https://nuget.pkg.github.com/DaanV2/index.json
- name: 📥 Restore dependencies
run: dotnet restore --verbosity normal
Expand All @@ -45,8 +83,7 @@ jobs:
- name: 📦 Create the package
run: dotnet pack --configuration Release Library

- name: 🚚 Publish the package to GPR
- name: 🚚 Publish the package to Nuget
run: |
cd ${{ github.workspace }}/Library/bin/Release/
dotnet nuget push *.nupkg
dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json
26 changes: 0 additions & 26 deletions .vscode/launch.json

This file was deleted.

6 changes: 3 additions & 3 deletions Library/Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<AssemblyName>DaanV2.NBT.Net</AssemblyName>
<RootNamespace>DaanV2.NBT</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Title>DaanV2.UUID.Net</Title>
<Title>DaanV2.NBT.Net</Title>
<Authors>DaanV2</Authors>
<Copyright>[email protected]</Copyright>
<FileVersion>$(VersionPrefix)</FileVersion>
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
<Version>2.0.0</Version>
<Version>2.0.3</Version>
<Platforms>AnyCPU;x64;x86</Platforms>
<SignAssembly>False</SignAssembly>
<Description>An NBT library for reading and writing NBT files/data</Description>
<Description>An NBT library for reading and writing NBT files, support Minecraft java and bedrock nbt/data</Description>
<PackageProjectUrl>https://github.com/DaanV2/DaanV2.NBT.Net</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down

0 comments on commit 49d7e69

Please sign in to comment.