Workflow fix #12
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: Build and Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
BuildAndTest: | |
runs-on: ubuntu-latest | |
name: Build Check | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
- name: Install dotnet 9 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '9.0.x' | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
BuildAndPublish: | |
needs: BuildAndTest | |
runs-on: ubuntu-latest | |
name: Update NuGet | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install dotnet 9 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '9.0.x' | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build (Release) and Publish | |
run: | | |
cd SudokuSolver | |
dotnet nuget add source --username kris701 --password ${{ secrets.API_KEY_GITHUB }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/kris701/index.json" | |
dotnet build --configuration Release | |
dotnet pack --configuration Release | |
cd bin | |
cd Release | |
dotnet nuget push "*.nupkg" --api-key ${{ secrets.API_KEY_GITHUB }} --source "github" --skip-duplicate | |
dotnet nuget push "*.nupkg" --api-key ${{ secrets.API_KEY_NUGET }} --source "https://api.nuget.org/v3/index.json" --skip-duplicate | |
cd .. | |
cd .. | |
- name: Get Package version | |
id: get-version | |
uses: kzrnm/get-net-sdk-project-versions-action@v1 | |
with: | |
proj-path: SudokuSolver/SudokuSolver.csproj | |
- name: Generate tag | |
continue-on-error: true | |
uses: rickstaa/action-create-tag@v1 | |
id: "tag_create" | |
with: | |
tag: "v${{ steps.get-version.outputs.package-version }}" | |
message: "Latest release" | |
- name: Generate Release | |
uses: ncipollo/release-action@v1 | |
with: | |
skipIfReleaseExists: true | |
artifacts: "SudokuSolver/bin/Release/*.nupkg" | |
tag: "v${{ steps.get-version.outputs.package-version }}" |