-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (54 loc) · 1.89 KB
/
netstandard20-package.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
# https://docs.github.com/ja/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions
# https://docs.github.com/ja/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry
name: Publish a package for netstandard2.0
on:
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
build-package:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 'dotnet/netstandard2.0/Standard20Library'
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
global-json-file: './dotnet/global.json'
- name: Build
run: |
dotnet build --configuration Release
- name: Pack
run: |
dotnet pack --no-build --configuration Release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: '**/*.nupkg'
# https://github.com/users/tsubakimoto/packages/nuget/package/Standard20Library
publish-package:
runs-on: ubuntu-latest
needs: build-package
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/download-artifact@v4
with:
name: nuget-packages
- name: Prepare NuGet
run: |
dotnet nuget add source --username tsubakimoto --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/tsubakimoto/index.json"
- name: Publish NuGet package
run: |
dotnet nuget push **/*.nupkg --source "github"
- name: Set current datetime
run: |
echo "CURRENT_DATETIME=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: '**/*.nupkg'
tag: ${{ env.CURRENT_DATETIME }}