Skip to content

Commit 573e2c4

Browse files
committed
Add GitHub CI and Publish to GitHub packages only
1 parent fcf059a commit 573e2c4

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish .NET Package
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
build-and-publish:
14+
runs-on: macos-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v5
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v5
22+
with:
23+
dotnet-version: 10.0.x
24+
source-url: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
25+
env:
26+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
27+
28+
- name: Install Workloads
29+
run: dotnet workload install android macos ios tvos maccatalyst --ignore-failed-sources
30+
31+
- name: Restore
32+
run: dotnet restore
33+
34+
- name: Building
35+
run: dotnet build --configuration Release --no-restore
36+
37+
- name: Packaging
38+
run: dotnet pack --configuration Release --no-build --output .
39+
40+
- name: Publishing
41+
if: github.event_name == 'push'
42+
run: dotnet nuget push *.nupkg --api-key ${{secrets.GITHUB_TOKEN}}

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@
33
`Hazelnut.Log` is Logging framework.
44

55
```shell
6-
$ # Using Nuget Package Manager Console
7-
$ nuget Install-Package Hazelnut.Log
6+
$ # Add Package Source of GitHub to .NET
7+
$ # This is required before add package
8+
$ dotnet nuget add source "https://nuget.pkg.github.com/daramkun/index.json" \
9+
--name "GitHub" \
10+
--username "<YOUR GITHUB USERNAME>" \
11+
--password "<YOUR PAT TOKEN>" \
12+
--store-password-in-clear-text
813
```
914

1015
```shell
1116
$ # Using .NET CLI
1217
$ dotnet add package Hazelnut.Log
1318
```
1419

20+
or
21+
1522
```xml
1623
<!-- Using csproj -->
1724
<PackageReference Include="Hazelnut.Log" Version="1.0.1" />

0 commit comments

Comments
 (0)