Skip to content

fix: remove release-created workflow instead as that was the redundan… #30

fix: remove release-created workflow instead as that was the redundan…

fix: remove release-created workflow instead as that was the redundan… #30

Workflow file for this run

name: .NET continuous build and test
on:
push:
branches:
- '*'
paths:
- 'src/**'
- 'test/**'
- 'examples/**'
- '*.sln'
- '.github/workflows/*'
jobs:
generate-version-number:
name: Generate version number
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-latest-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Fetch all tags
run: git fetch --tags --depth=1
- name: Get latest version number
run: |
latest_tag=$(git tag -l "v*" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)
echo "LATEST_VERSION=${latest_tag:1}" >> $GITHUB_ENV
echo "Latest tag found: $latest_tag"
- name: Create version variable
id: get-latest-version
run: |
version=$LATEST_VERSION
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
major_version=${BASH_REMATCH[1]}
minor_version=${BASH_REMATCH[2]}
patch_version=${BASH_REMATCH[3]}
version="$major_version.$minor_version.$((patch_version + 1))"
else
version=1.0.0
fi
echo "Version that will be used: $version"
echo "version=$version" >> $GITHUB_OUTPUT
continuous_build_test_pack_push:
name: Continuous build, test, and prerelease package upload
runs-on: ubuntu-latest
needs: generate-version-number
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Pack
env:
PACKAGE_VERSION: ${{ needs.generate-version-number.outputs.version }}
run: |
dotnet pack src/Fenris.OneOfContrib.Blazor/ \
-c Release \
-o ./artifacts \
--verbosity minimal \
-p:PackageVersion=${{ env.PACKAGE_VERSION }}-alpha.${{ github.run_number }}
- name: Push implementation package
run: |
dotnet nuget push ./artifacts/*.nupkg \
--source "https://api.nuget.org/v3/index.json"
- name: Push symbols package
run: |
dotnet nuget push ./artifacts/*.snupkg \
--source "https://www.nuget.org/api/v2/symbolpackage"