added method to retrieve cross diagonal cells from origin one #36
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: "Deploy to NuGet registry" | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
permissions: | |
id-token: write | |
contents: read | |
checks: write | |
runs-on: ubuntu-latest | |
outputs: | |
Version: ${{ steps.gitversion.outputs.SemVer }} | |
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 #fetch-depth is needed for GitVersion | |
#Install and calculate the new version with GitVersion | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: 5.x | |
- name: Determine Version | |
uses: gittools/actions/gitversion/[email protected] | |
id: gitversion # step id used as reference for output values | |
- name: Display GitVersion outputs | |
run: | | |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}" | |
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" | |
# Build/pack the project | |
- name: Setup .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: 8.0.x | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Test with dotnet | |
run: dotnet test ${{ vars.CSPROJ_TESTS_PATH }} --logger "trx;LogFileName=test-results.trx" || true | |
- name: Test Report | |
uses: dorny/[email protected] | |
if: success() || failure() | |
with: | |
name: Dotnet Tests result | |
path: "**/test-results.trx" | |
reporter: dotnet-trx | |
fail-on-error: true | |
- name: Build and Pack NuGet package with versioning | |
run: dotnet pack ${{ vars.CSPROJ_PATH }} -p:GeneratePackageOnBuild=false -p:Version='${{ steps.gitversion.outputs.SemVer }}' -c Release | |
- name: Upload NuGet package to GitHub | |
uses: actions/[email protected] | |
with: | |
name: nugetPackage | |
path: Match3Maker/bin/Release | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' # only run job if on the main branch | |
steps: | |
#Push NuGet package to GitHub packages | |
- name: Download nuget package artifact | |
uses: actions/[email protected] | |
with: | |
name: nugetPackage | |
- name: Test nuget artifact download | |
run: ls -R | |
- name: Prep packages | |
run: dotnet nuget add source --username ${{ vars.USERNAME }} --password ${{ secrets.NUGET_PACKAGE_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{ vars.USERNAME }}/index.json" | |
- name: Push package to GitHub packages | |
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change | |
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_PACKAGE_TOKEN }} --source "github" | |
# Publish to NuGet.org | |
- name: Publish to NuGet.org | |
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
#Create release | |
- name: Create Release | |
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only release if there has been a commit/version change | |
uses: ncipollo/[email protected] | |
with: | |
tag: ${{ needs.build.outputs.Version }} | |
name: Release ${{ needs.build.outputs.Version }} | |
artifacts: "*" | |
token: ${{ secrets.NUGET_PACKAGE_TOKEN }} |