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
83 changes: 83 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI Build

on:
push:
branches:
- '**'
pull_request:
branches:
- master

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Calculate version
id: version
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$year = (Get-Date).Year
$month = (Get-Date).Month
$startOfMonth = (Get-Date -Day 1 -Hour 0 -Minute 0 -Second 0).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")

$headers = @{
Authorization = "Bearer $env:GITHUB_TOKEN"
Accept = "application/vnd.github.v3+json"
}
$url = "https://api.github.com/repos/$env:GITHUB_REPOSITORY/actions/workflows/build.yml/runs?created=>=$startOfMonth&per_page=1"
$response = Invoke-RestMethod -Uri $url -Headers $headers -ErrorAction Stop
$rev = $response.total_count

$version = "1.$year.$month.$rev"
"VERSION=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "Computed version: $version"

- name: Patch AssemblyInfo.cs
shell: pwsh
run: |
$version = "${{ steps.version.outputs.VERSION }}"
$file = "StepManipulationTool\Properties\AssemblyInfo.cs"
(Get-Content $file) `
-replace 'AssemblyVersion\("[^"]*"\)', "AssemblyVersion(`"$version`")" `
-replace 'AssemblyFileVersion\("[^"]*"\)', "AssemblyFileVersion(`"$version`")" |
Set-Content $file
Write-Host "Patched $file to version $version"

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

- name: NuGet restore
run: nuget restore StepsManipulationTool.sln

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

- name: Build solution
run: msbuild StepsManipulationTool.sln /p:Configuration=Release /p:Platform="Any CPU" /m

- name: Patch nuspec version
shell: pwsh
run: |
$version = "${{ steps.version.outputs.VERSION }}"
$nuspec = Resolve-Path "StepManipulationTool.nuspec"
[xml]$xml = Get-Content $nuspec
$xml.package.metadata.version = $version
$xml.Save($nuspec)
Write-Host "Patched nuspec to version $version"

- name: NuGet pack
run: nuget pack StepManipulationTool.nuspec -OutputDirectory nupkg

- name: Upload nupkg artifact
uses: actions/upload-artifact@v4
with:
name: nupkg-${{ steps.version.outputs.VERSION }}
path: nupkg/*.nupkg
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
workflow_dispatch:
inputs:
run_id:
description: 'CI run ID whose nupkg artifact to publish (find it in the Actions tab URL)'
required: true

jobs:
release:
runs-on: windows-latest

steps:
- name: Download nupkg artifact from CI run
uses: actions/download-artifact@v4
with:
run-id: ${{ inputs.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
pattern: 'nupkg-*'
path: nupkg
merge-multiple: true

- name: Resolve version from nupkg filename
id: version
shell: pwsh
run: |
$pkg = Get-ChildItem nupkg\*.nupkg | Select-Object -First 1
if (-not $pkg) { throw "No .nupkg found in artifact" }
# filename: ImranAkram.XTB.StepManipulationTool.1.2026.4.3.nupkg
$version = $pkg.BaseName -replace '^ImranAkram\.XTB\.StepManipulationTool\.', ''
"VERSION=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "Releasing version: $version ($($pkg.Name))"

- name: Publish to NuGet.org
run: nuget push nupkg\*.nupkg -ApiKey ${{ secrets.NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json -NonInteractive

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.VERSION }}
name: Release ${{ steps.version.outputs.VERSION }}
generate_release_notes: true
files: nupkg/*.nupkg
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,5 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd
**/.vscode
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,28 @@ Before running advanced operations:
- Restore NuGet packages
- Build in **Release**

### CI/CD (GitHub Actions)

Two workflows live in `.github/workflows/`:

| Workflow | Trigger | What it does |
|---|---|---|
| `build.yml` | Push to any branch / PR to master | Restores, builds in Release, packs the `.nupkg`, and uploads it as a versioned artifact |
| `release.yml` | Manual (`workflow_dispatch`) | Downloads the `.nupkg` from a chosen CI run, publishes to [nuget.org](https://www.nuget.org/packages/ImranAkram.XTB.StepManipulationTool), and creates a GitHub release |

Versions are auto-generated as `1.{yyyy}.{M}.{rev}` (e.g. `1.2026.4.3`) where `rev` is the monthly CI build count.

**Required secret:** `NUGET_API_KEY` — a nuget.org API key with push access, stored in repo Settings → Secrets → Actions.

#### How to publish a release

The `.nupkg` is built and validated by CI — the release workflow just promotes it. No rebuild happens at release time.

1. Go to the **Actions** tab and find the `CI Build` run you want to ship (typically the latest green run on `master`).
2. Copy the **run ID** from the URL: `https://github.com/.../actions/runs/`**`<run_id>`**
3. Go to **Actions → Release → Run workflow**, paste the run ID, and click **Run workflow**.
4. The workflow will push the `.nupkg` to nuget.org and create a tagged GitHub release automatically.

### Debug (optional)
- Copy the built plugin output to your local XrmToolBox `Plugins` folder (or use your existing XTB dev workflow)
- Start XrmToolBox and load the tool
Expand Down
15 changes: 7 additions & 8 deletions StepManipulationTool.nuspec
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>Innofactor.XTB.StepManipulationTool</id>
<id>ImranAkram.XTB.StepManipulationTool</id>
<version>1.0.0</version>
<title>Step Manipulation Tool for XrmToolBox</title>
<authors>Imran Akram, Alexey Shytikov, Biznamics AB</authors>
<owners>Biznamics AB</owners>
<projectUrl>https://github.com/Biznamics/StepsManipulationTool</projectUrl>
<authors>Imran Akram, Olekssi Shytikov</authors>
<owners>Imran Akram</owners>
<projectUrl>https://github.com/imranakram/StepsManipulationTool</projectUrl>
<icon>icon.png</icon>
<readme>docs\README.md</readme>
<iconUrl>https://user-images.githubusercontent.com/13014005/116875731-aa86fd80-ac1b-11eb-875b-2d43121c47c5.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Tool to perform unsafe operations with plugin steps. Move steps between plugins by preserving their guids!
</description>
<summary>Perform unsafe operations such as moving steps between plugins. This preserves their guids which is very useful for upgrading major versions of plugins.</summary>
<releaseNotes>

</releaseNotes>
<copyright>Copyright 2016-2026 Biznamics AB</copyright>
<copyright>Copyright 2016-2026 Imran Akram</copyright>
<tags>XrmToolBox Plugins StepManipulationTool Step Manipulator</tags>
<dependencies>
<dependency id="XrmToolBoxPackage" version="1.2025.10.74" />
</dependencies>
</metadata>
<files>
<file src="StepManipulationTool\bin\Release\Innofactor.XTB.StepManipulationTool.dll" target="lib\net48\Plugins" />
<file src="StepManipulationTool\bin\Release\ImranAkram.XTB.StepManipulationTool.dll" target="lib\net48\Plugins" />
<file src="icon.png" target="" />
<file src="README.md" target="docs\" />
</files>
Expand Down
27 changes: 9 additions & 18 deletions StepManipulationTool/About.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion StepManipulationTool/About.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Innofactor.XTB.StepManipulationTool
namespace XTB.StepManipulationTool
{
using System;
using System.Collections.Generic;
Expand Down
Loading
Loading