-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Build, Test & Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET 8.0 | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Extract Version from tag | ||
id: tag | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const version = context.ref.replace('refs/tags/', ''); | ||
return version.slice(1); | ||
- name: Change Package Version | ||
working-directory: ./src | ||
run: | | ||
sed -i -e "s/<Version>[a-zA-Z0-9.-]*<\/Version>/<Version>${{ steps.tag.outputs.result }}<\/Version>/g" Nager.Date/Nager.Date.csproj | ||
- name: Restore dependencies | ||
working-directory: ./src | ||
run: dotnet restore | ||
- name: Build | ||
working-directory: ./src | ||
run: dotnet build --configuration Release --no-restore | ||
- name: Test | ||
working-directory: ./src | ||
run: | | ||
dotnet test --configuration Release --no-restore --no-build --verbosity normal | ||
- name: Change LicenseKey | ||
working-directory: ./src | ||
run: | | ||
sed -i 's/DCDCB65FD3009576BC11E23C883220F6292709DEB93174D0913D2E89DB3D5D88/${{secrets.PUBLIC_KEY1}}/g' Nager.Date/HolidaySystem.cs | ||
sed -i 's/17F32AEC71CCB3D20166DCC7F49B32C1153464105344608692E005B16284A41D/${{secrets.PUBLIC_KEY2}}/g' Nager.Date/HolidaySystem.cs | ||
- name: Build project and generate NuGet package | ||
run: | | ||
dotnet pack --configuration Release --output $GITHUB_WORKSPACE/out src/Nager.Date/Nager.Date.csproj | ||
#- name: Push NuGet package | ||
# if: github.event_name != 'pull_request' | ||
# run: | | ||
# cd $GITHUB_WORKSPACE/out | ||
# dotnet nuget push *.nupkg --source https://www.nuget.org/api/v2/package --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate --no-symbols |