Skip to content

Events Release

Events Release #4

Workflow file for this run

name: Events Release
permissions:
contents: read
packages: write
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
type: string
required: true
description: The version to be published
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
dotnet-version: [ '6.0.x', '7.0.x', '8.0.x' ]
steps:
- uses: actions/checkout@v4
- name: Set the TFM in Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
VERSION=$(echo "${{ matrix.dotnet-version }}" | sed 's/[^0-9.]*//g')
VERSION=$(echo "${VERSION}" | sed 's/\.$//')
DOTNET_TFM="net${VERSION}"
echo "DOTNET_TFM=$DOTNET_TFM" >> $GITHUB_ENV
- name: Set the TFM in Windows
if: startsWith(matrix.os, 'windows')
run: |
$VERSION = "${{ matrix.dotnet-version }}".Substring(0, "${{ matrix.dotnet-version }}".LastIndexOf('.'))
$DOTNET_TFM = "net$VERSION"
echo "DOTNET_TFM=$DOTNET_TFM" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Setup .NET ${{ matrix.dotnet-version }} Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: dotnet test --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Test (Windows)
if: startsWith(matrix.os, 'windows')
run: dotnet test --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --filter Channel!=RabbitMQ
- name: Collect to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
publish:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GitVsion
if: ${{ inputs.version }} == null
uses: gittools/actions/gitversion/setup@v3.0.0
with:
versionSpec: '5.x'
- name: Determine GitVersion
if: ${{ inputs.version }} == null
id: gitversion
uses: gittools/actions/gitversion/execute@v3.0.0
with:
updateAssemblyInfo: true
# - name: Extract the Version
# run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | sed -e 's/^v//')" >> $GITHUB_ENV
# if: github.event.release.tag_name != null
- name: Set the Version from Input
run: echo "GitVersion_SemVer=${{ inputs.version }}" >> $GITHUB_ENV
if: ${{ inputs.version }} != null
- name: Pack NuGet
run: dotnet pack -p:PackageVersion=${{ env.GitVersion_SemVer }} -c Release -o ./nuget -p:Version=${{ env.GitVersion_SemVer }} --include-symbols --include-source
- name: Push Github Nuget
run: dotnet nuget push ./nuget/*.nupkg -s "https://nuget.pkg.github.com/deveel/index.json" --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}}
- name: Push to Github.org
run: dotnet nuget push ./nuget/**/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json