Skip to content

workflow file

workflow file #1

Workflow file for this run

name: Release 2.2
on:
workflow_dispatch:
push:
branches:
- 'release/**'
pull_request:
branches:
- 'main'
- 'release/**'
paths-ignore:
- '.attachments/**'
- '.editorconfig'
- '.gitignore'
- 'LICENSE'
- 'README.md'
jobs:
build:
name: Build 2.2
runs-on: windows-latest
outputs:
version: ${{ steps.define-version.outputs.version }}
env:
Scripts: .\.github\workflows\scripts
TemporaryPfxFilePath: .\GitHubActionsWorkflow.pfx
BuildOutputPath: .\Tum4ik.StinimGen\bin\Release\netstandard2.0
PackOutputPath: .\Tum4ik.StinimGen\bin\Release\pack
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Install .NET
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
- name: Define version
id: define-version
run: |
$majorMinor = "${{ github.ref_name }}".Split("/")[-1]
if (![System.Version]::TryParse($majorMinor, [ref]$null)) { $majorMinor = "0.0" }
$buildNumber = "$(Get-Date -Format 'yy')$((Get-Date).DayOfYear.ToString().PadLeft(3, '0'))"
$version = "$majorMinor.$buildNumber.${{ github.run_number }}"
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Build
run: |
$version = "${{ steps.define-version.outputs.version }}"
dotnet build `
-c Release `
--nologo `
/p:PackageVersion=$version `
/p:Version=$version `
/p:GeneratePackageOnBuild=false `
/p:ContinuousIntegrationBuild=true
- name: Test
run: |
dotnet test `
-c Release `
--nologo `
--no-build
- name: Sign code files
run: |
${{ env.Scripts }}\DecodePfx.ps1 `
-Base64Pfx "${{ secrets.BASE64_ENCODED_PFX }}" `
-OutputPath ${{ env.TemporaryPfxFilePath }}
${{ env.Scripts }}\SignMyCodeFiles.ps1 `
-FilesDirectoryPath ${{ env.BuildOutputPath }} `
-PfxFilePath ${{ env.TemporaryPfxFilePath }} `
-PfxPassword ${{ secrets.PFX_KEY }}
${{ env.Scripts }}\SignMyCodeFiles.ps1 `
-FilesDirectoryPath .\Tum4ik.StinimGen.Attributes\bin\Release\netstandard2.0 `
-PfxFilePath ${{ env.TemporaryPfxFilePath }} `
-PfxPassword ${{ secrets.PFX_KEY }}
Remove-Item -Path ${{ env.TemporaryPfxFilePath }}
- name: Pack
run: |
$version = "${{ steps.define-version.outputs.version }}"
dotnet pack .\Tum4ik.StinimGen\Tum4ik.StinimGen.csproj `
-c Release `
--nologo `
--no-build `
-o ${{ env.PackOutputPath }} `
/p:PackageVersion=$version `
/p:Version=$version `
/p:IncludeSymbols=true `
/p:SymbolPackageFormat=snupkg
- name: Upload package
uses: actions/[email protected]
with:
if-no-files-found: error
name: Package
path: ${{ env.PackOutputPath }}
- name: Upload release notes
uses: actions/[email protected]
with:
if-no-files-found: error
name: ReleaseNotes
path: .\SolutionProperties\ReleaseNotes.txt
nuget-release:
name: NuGet Release ${{ needs.build.outputs.version }}
if: github.event_name != 'pull_request' && contains(github.ref_name, 'release')
needs: build
runs-on: windows-latest
steps:
- name: Download build artifacts
uses: actions/[email protected]
with:
name: Package
- name: NuGet push
run: |
dotnet nuget push "**/*.nupkg" `
-s https://api.nuget.org/v3/index.json `
-k ${{ secrets.NUGET_API_KEY }}
github-release:
name: GitHub Release ${{ needs.build.outputs.version }}
if: github.event_name != 'pull_request' && contains(github.ref_name, 'release')
needs: build
runs-on: windows-latest
steps:
- name: Download build artifacts
uses: actions/[email protected]
with:
name: ReleaseNotes
- name: GitHub release
env:
GH_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create ${{ needs.build.outputs.version }} `
--latest `
--title ${{ needs.build.outputs.version }} `
--notes-file ReleaseNotes.txt