I would like to migrate my add-in development to github and enable easy updating.
Before I go deep into developing this: is there anybody that already built something like this. Anything you can share?
I have a working version.
Here is my code repository, code contributions are welcome!
Build
I just started working on this for my own add-ins, I got as far as a powershell script that I can kick off in GitLab using YAML, but I haven't dove into GitHub's CI yet. Here is my first-draft build script:
#PowerShell
#Config
# Set output file name
$FilePathPrefix = "JMPValidation"
#Run Unit Tests
#NaturalDocs
& "C:\Program Files (x86)\Natural Docs\NaturalDocs.exe" "NaturalDocs"
#Save temporary copy of files
$TempPath = "AddinFilesTempForBuild/"
if (Test-Path $TempPath) {
Remove-Item -Recurse -Force -Confirm:$false $TempPath
}
New-Item -Path $TempPath -ItemType Directory
Copy-Item -Recurse -Path "AddinFiles\*" -Destination $TempPath
#Update temporary copy of files
$updatetime = Get-Date ((Get-Date).ToUniversalTime()) -UFormat %s
$updatetime = [math]::Round($updatetime) + 2082823200
$customMetadataPath = $TempPath+"customMetadata.jsl"
(Get-Content $customMetadataPath) `
-replace 'List\( \"buildDate\", (\d+) \),', ('List( "buildDate", '+$updatetime+' ),') |
Out-File $customMetadataPath
$content = Get-Content -path $customMetadataPath
#Make add-in file
$ZipFileName = $FilePathPrefix+".zip"
$AddinFileName = $FilePathPrefix+".jmpaddin"
if (Test-Path $ZipFileName) {
Remove-Item -Recurse -Force -Confirm:$false $ZipFileName
}
if (Test-Path $AddinFileName) {
Remove-Item -Recurse -Force -Confirm:$false $AddinFileName
}
$compress = @{
Path = $TempPath+"\*"
CompressionLevel = "Fastest"
DestinationPath = $ZipFileName
}
Compress-Archive @compress
Rename-Item -Path $ZipFileName -NewName $AddinFileName
#Cleanup
if (Test-Path $TempPath) {
Remove-Item -Recurse -Force -Confirm:$false $TempPath
}
Auto-Updating
Check out this article:
Add-In Manager, Part 2: Deploying auto-updating add-ins to users
I have a working version.
Here is my code repository, code contributions are welcome!
We have built something similar at our company, and we gave a talk on it at last year's JDS! As Easy as Uploading a Photo: Building, Sharing, and Updating Add-ins Automatica... - JMP User Commu...
We use GitLab but conceptually it's similar. We've included a ZIP of our build scripts at the link above.
Thanks, I did actually look at that before I started. I need to look into GitLab some more maybe.
I ran ours on tag for releases, but we had multiple developers and we wanted to have more general testing than what we had for all merge requests. One thing that tripped me up REAL hard when having a CI pipeline run was having the pipeline run things as system. I had to use PSExec to get past some JMP dialogs (just the first time).
I ran ours on tag for releases, but we had multiple developers and we wanted to have more general testing than what we had for all merge requests.
Our solution as implemented immediately builds the add-in for any new commit on a branch named `beta` from literally anyone in our company who wants to contribute, and we have a staged multi-branch release that's owned by our maintainers who QC contributions on a two-week cycle for `main` branch releases. This introduces instantaneous builds but also a measure of quality control. That said, I wouldn't leave the `beta` branch building on demand in a public repo on the wide internet, that only works because I can tell if someone is trying to be nefarious, who it is, and there'd be repercussions for doing so.
We also include functionality that automatically adds any `Function()` defined in a namespace in the `importables` directory into the JMP Scripting Index for JMP 14+, parsing out details of the function to form the documentation in the index. See the video, PDF, or ZIP from my talk for details! Also, please feel free to adapt or adopt anything from our codebase. We're fans of open practices!
Can you share your workflow yaml? Or were you also in GitLab?