Skip to content

Refactor libraries, update README, add new classes #3

Refactor libraries, update README, add new classes

Refactor libraries, update README, add new classes #3

Workflow file for this run

name: .NET CI/CD Workflow
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
jobs:
prepare_versions:
name: Create Version Strings
runs-on: ubuntu-latest
outputs:
ReleaseVersion: ${{ steps.find.outputs.tag }}
PreviewAssemblyVersion: ${{ steps.set_version.outputs.preview_assembly_version }}
PreviewPackageVersion: ${{ steps.set_version.outputs.preview_package_version }}
steps:
- uses: actions/checkout@v3
- name: Find Latest Tag
id: find
uses: oprypin/find-latest-tag@v1.0.4
with:
repository: ${{ github.repository }}
releases-only: true
- name: Set version output
id: set_version
run: |
echo "::set-output name=preview_assembly_version::${{ steps.find.outputs.tag }}.${{ github.run_number }}"
echo "::set-output name=preview_package_version::${{ steps.find.outputs.tag }}.${{ github.run_number }}-preview"
build_test:
name: Pull Request Job
needs: prepare_versions
if: github.event_name == 'pull_request'
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build (${{ needs.prepare_versions.outputs.PreviewAssemblyVersion }})
run: dotnet build --configuration Release /p:Version=${{ needs.prepare_versions.outputs.PreviewAssemblyVersion }}
- name: Test
run: dotnet test --configuration Release --no-build
build_pack_publish_preview:
name: Merge Job
needs: prepare_versions
if: github.event_name == 'push'
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build (${{ needs.prepare_versions.outputs.PreviewAssemblyVersion }})
run: dotnet build --configuration Release /p:Version=${{ needs.prepare_versions.outputs.PreviewAssemblyVersion }}
- name: Test
run: dotnet test --configuration Release --no-build
- name: Pack
run: dotnet pack --configuration Release --no-build --output nupkgs /p:Version=${{ needs.prepare_versions.outputs.PreviewPackageVersion }}
- name: Publish NuGet
run: dotnet nuget push "nupkgs/*.nupkg" -k ${{ secrets.NugetKey }} -s https://api.nuget.org/v3/index.json --skip-duplicate
build_pack_publish_release:
name: Release Job
needs: prepare_versions
if: github.event_name == 'release'
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build (${{ needs.prepare_versions.outputs.ReleaseVersion }})
run: dotnet build --configuration Release /p:Version=${{ needs.prepare_versions.outputs.ReleaseVersion }}
- name: Test
run: dotnet test --configuration Release --no-build
- name: Pack
run: dotnet pack --configuration Release --no-build --output nupkgs /p:Version=${{ needs.prepare_versions.outputs.ReleaseVersion }}
- name: Publish NuGet
run: dotnet nuget push "nupkgs/*.nupkg" -k ${{ secrets.NugetKey }} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Set GitHub Package Source
continue-on-error: true
run : dotnet nuget add source --username frankhaugen --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/frankhaugen/index.json"
- name: Push NuGet Package to GitHub
continue-on-error: true
run: dotnet nuget push "nupkgs/*.nupkg" --source "github" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
- name: Get Current Release
id: get_current_release
uses: joutvhu/get-release@v1
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Attach artifiacts to release
uses: xresloader/upload-to-github-release@main
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "nupkgs/*.nupkg"
release_id: ${{ steps.get_current_release.outputs.id }}
overwrite: false
verbose: true