Merge pull request #40 from shinji-san/release-v1.0.0 #3
Workflow file for this run
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
name: LuhnDotNet NuGet | |
on: | |
push: | |
tags: | |
- 'v*' | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET 6 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.416 | |
- name: Setup .NET 7 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 7.0.403 | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.100 | |
- name: Decrypt large secret | |
run: ./.github/secrets/decrypt_publisher_snk.sh | |
env: | |
PUBLISHER_SNK: ${{ secrets.PUBLISHER_SNK }} | |
PUBLISHER_PUB_KEY: ${{ secrets.PUBLISHER_PUB_KEY }} | |
- name: Restore | |
run: dotnet restore LuhnDotNet.sln | |
- name: Build | |
run: dotnet build --no-restore --configuration Release LuhnDotNet.sln | |
- name: Test | |
run: dotnet test --no-restore --no-build --configuration Release LuhnDotNet.sln | |
- name: Remove obsolete NuGet packages | |
run: rm -f src/bin/Release/LuhnDotNet*.nupk | |
- name: Prepare README.md for NuGet package | |
run: | | |
grep -n "## Install LuhnDotNet package" README.md | cut -d: -f 1| xargs -i tail -n +{} README.md > TMP.md && sed -i '1s/^/# Setup\r\n/' TMP.md && mv -f TMP.md README.md | |
grep -n "# CLI building instructions" README.md | cut -d: -f 1| xargs -i head -n {} README.md | head -n -1 > TMP.md && mv -f TMP.md README.md | |
- name: Create package | |
run: dotnet pack --no-restore --no-build --configuration Release LuhnDotNet.sln | |
- name: Publish package | |
run: dotnet nuget push $(find src/bin/Release -type f -name 'LuhnDotNet*.nupkg' -print 2> /dev/null) -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate |