Publish a package for netstandard2.0 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }} |