Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/Pre-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'Build Pre-release'
on:
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/sw_build.yml
with:
gitversion-config: './.github/GitVersion.yml'
push_artifact: true
5 changes: 3 additions & 2 deletions .github/workflows/Pull-Request-Labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v3
- uses: TimonVS/pr-labeler-action@v5.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

15 changes: 4 additions & 11 deletions .github/workflows/Pull-Request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@ on:
workflow_dispatch:

jobs:
init:
uses: elendil-software/github-actions/.github/workflows/init-workflow.yml@main

gitversion:
needs: init
uses: elendil-software/github-actions/.github/workflows/gitversion.yml@main
with:
config: './.github/GitVersion.yml'

build:
needs: gitversion
uses: elendil-software/github-actions/.github/workflows/dotnet-build.yml@main
uses: ./.github/workflows/sw_build.yml
with:
gitversion-config: './.github/GitVersion.yml'
push_artifact: false
21 changes: 0 additions & 21 deletions .github/workflows/Push-Dev-Nuget.yml

This file was deleted.

34 changes: 8 additions & 26 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,15 @@ on:
workflow_dispatch:

jobs:
init:
uses: elendil-software/github-actions/.github/workflows/init-workflow.yml@main

gitversion:
needs: init
uses: elendil-software/github-actions/.github/workflows/gitversion.yml@main
with:
config: './.github/GitVersion-Release.yml'

build:
needs: gitversion
uses: elendil-software/github-actions/.github/workflows/dotnet-build.yml@main

nuget-push:
needs: build
uses: elendil-software/github-actions/.github/workflows/nuget-push-nugetorg.yml@main
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
uses: ./.github/workflows/sw_build.yml
with:
gitversion-config: './.github/GitVersion-Release.yml'
push_artifact: true

release:
needs: [gitversion, build]
uses: elendil-software/github-actions/.github/workflows/tag-release.yml@main
needs: [build]
uses: ./.github/workflows/sw_tag-release.yml
with:
git_config_user_email: 'git@elendil.software'
git_config_user_name: ${{ github.repository_owner }}
git_tag: ${{needs.gitversion.outputs.SemVer}}
changelog_builder_configuration: './.github/release-changelog-builder-configuration.json'
release_artifacts: "**/*.nupkg"
secrets:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
git_tag: ${{needs.build.outputs.SemVer}}
changelog_builder_configuration: './.github/release-changelog-builder-configuration.json'
87 changes: 87 additions & 0 deletions .github/workflows/sw_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: 'Build (Sub-Workflow)'
on:
workflow_call:
inputs:
gitversion-config:
description: 'Path to GitVersion configuration file'
required: true
type: string
push_artifact:
description: 'Push the generated artifact'
default: false
required: false
type: boolean
artifact_name_out:
description: 'Name of the artifact'
default: 'artifact'
required: false
type: string
artifact_retention_days:
description: 'retention days for the artifact'
default: 5
required: false
type: number

outputs:
MajorMinorPatch:
value: ${{ jobs.build.outputs.MajorMinorPatch }}
SemVer:
value: ${{ jobs.build.outputs.SemVer }}

jobs:
build:
name: 'Build'
runs-on: windows-latest
outputs:
MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}
SemVer: ${{ steps.gitversion.outputs.SemVer }}

steps:
- name: 'Checkout'
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0

- name: 'Setup MSBuild'
uses: microsoft/setup-msbuild@v2

- name: 'Setup GitVersion'
uses: gittools/actions/gitversion/setup@v1.2.0
with:
versionSpec: '5.x'

- name: 'GitVersion updateprojectfiles'
id: gitversion
uses: gittools/actions/gitversion/execute@v1.2.0
with:
useConfigFile: true
configFilePath: ${{ inputs.gitversion-config }}
additionalArguments: '/updateprojectfiles'

- name: 'Build'
run: dotnet build ./IPX800cs/IPX800cs.csproj --configuration Release --output ./Output/IPX800cs

- name: 'Run tests'
run: dotnet test ./IPX800cs.sln --configuration Release --collect:"XPlat Code Coverage"

- name: 'Report Generator'
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.13
with:
reports: './**/TestResults/**/coverage.cobertura.xml'
targetdir: 'coveragereport'
reporttypes: 'HtmlSummary'

- name: 'Upload coverage report artifact'
uses: actions/upload-artifact@v4.5.0
with:
name: CoverageReport
path: coveragereport
retention-days: ${{ inputs.artifact_retention_days }}

- name: 'Upload source artifact'
if: ${{ inputs.push_artifact == true }}
uses: actions/upload-artifact@v4.5.0
with:
name: ${{ inputs.artifact_name_out }}
path: ./Output/IPX800cs/*.nupkg
retention-days: ${{ inputs.artifact_retention_days }}
65 changes: 65 additions & 0 deletions .github/workflows/sw_tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 'Tag & Release (Sub-Workflow)'
on:
workflow_call:
inputs:
git_tag:
description: 'Git tag to create'
required: true
type: string
artifact_name_in:
description: 'Name of an artifact saved by a previous workflow'
default: 'artifact'
required: false
type: string
changelog_builder_configuration:
description: 'Relative path to the configuration.json file for the mikepenz/release-changelog-builder-action'
required: true
type: string

jobs:
release:
name: 'Create Tag and Release'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0

- name: 'Download source artifact'
uses: actions/download-artifact@v4.1.8
with:
name: ${{ inputs.artifact_name_in }}
path: ${{ inputs.artifact_name_in }}

- name: 'Create Tag'
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
tag_prefix: ''
custom_tag: ${{ inputs.git_tag }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Build Changelog'
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v5.0.0
with:
failOnError: true
configuration: '${{ inputs.changelog_builder_configuration }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'Create Release'
uses: ncipollo/release-action@v1.12.0
with:
artifactErrorsFailBuild: true
draft: false
body: '${{steps.build_changelog.outputs.changelog}}'
tag: '${{ inputs.git_tag }}'
artifacts: '${{ inputs.artifact_name_in }}/*'
token: ${{ secrets.GITHUB_TOKEN }}

- name: 'Push .nupkg files to nuget.org'
run: dotnet nuget push ${{ inputs.artifact_name_in }}/*.nupkg --api-key $API_KEY --source https://api.nuget.org/v3/index.json
env:
API_KEY: ${{ secrets.NUGET_API_KEY }}
4 changes: 3 additions & 1 deletion IPX800cs.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{0D379098-AE02-4E0F-87CB-97BC89C80A28}"
ProjectSection(SolutionItems) = preProject
.github\workflows\Release.yml = .github\workflows\Release.yml
.github\workflows\Push-Dev-Nuget.yml = .github\workflows\Push-Dev-Nuget.yml
.github\workflows\Pull-Request-Labeler.yml = .github\workflows\Pull-Request-Labeler.yml
.github\workflows\Pull-Request.yml = .github\workflows\Pull-Request.yml
.github\workflows\sw_tag-release.yml = .github\workflows\sw_tag-release.yml
.github\workflows\sw_build.yml = .github\workflows\sw_build.yml
.github\workflows\Pre-version.yml = .github\workflows\Pre-version.yml
EndProjectSection
EndProject
Global
Expand Down