ci: publish releases from CI on a version tag, starting with 5.0.0-rc1
Pushing a tag such as 5.0.0 or 5.0.0-rc1 on master now publishes the
package that the build job built and tested to the PowerShell Gallery
and creates the GitHub release with NTFSSecurity.zip.
- New-ModulePackage.ps1 copies only the FileList files of the Release
build, so no debug symbols, XML documentation, or copy of
System.Management.Automation.dll ship. It builds the nupkg with
Compress-PSResource and adds the command tags (PSIncludes_Cmdlet,
PSCmdlet_*, PSCommand_*) that PSResourceGet leaves out and that the
Gallery uses to list cmdlets and that Find-Command searches. Every CI
run builds and uploads the packages.
- Get-ReleaseInfo.ps1 returns the version and release notes: a dated
CHANGELOG section for a release, the [Unreleased] section for a
prerelease.
- The release job checks that the tag matches the manifest version and
points to a commit on master, reads the API key from the environment
powershell-gallery, and skips steps already done, so a rerun is safe.
- The manifest gets the prerelease label rc1 and a release notes link;
the 5.0.0 changelog entries move back to [Unreleased] until the final
release.
- Tests/Release.Tests.ps1 covers both scripts and the packages; the
changelog check moves there from Manifest.Tests.ps1.
- Docs/Contributing/05-Releasing.md describes the one-time setup and the
release steps; Docs/README.md explains -AllowPrerelease.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
|
|
|
# Release a new version
|
|
|
|
|
|
|
|
|
|
This page explains how a maintainer releases a new version of NTFSSecurity.
|
|
|
|
|
The CI workflow does the work: when you push a version tag, it builds and
|
|
|
|
|
tests the module, publishes the package to the PowerShell Gallery, and creates
|
|
|
|
|
the GitHub release with `NTFSSecurity.zip`.
|
|
|
|
|
|
|
|
|
|
## Prepare the repository once
|
|
|
|
|
|
|
|
|
|
1. In the PowerShell Gallery, [create an API key][api-key] for the account
|
|
|
|
|
that owns NTFSSecurity. Select the scope **Push new versions of existing
|
|
|
|
|
packages**, enter `NTFSSecurity` as the glob pattern, and choose an
|
|
|
|
|
expiration.
|
|
|
|
|
2. In the settings of the repository on GitHub, under **Environments**,
|
|
|
|
|
create the environment `powershell-gallery`. To approve every release
|
|
|
|
|
before it's published, add yourself as a required reviewer. Under
|
|
|
|
|
**Deployment branches and tags**, allow only tags such as
|
|
|
|
|
`[0-9]*.[0-9]*.[0-9]*`.
|
|
|
|
|
3. Add the API key as the secret `PSGALLERY_API_KEY` of the environment.
|
|
|
|
|
The command asks for the key:
|
|
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
|
gh secret set PSGALLERY_API_KEY --env powershell-gallery --repo raandree/NTFSSecurity
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Renew the API key before it expires, and update the secret.
|
|
|
|
|
|
|
|
|
|
## Versions
|
|
|
|
|
|
|
|
|
|
- `ModuleVersion` in `NTFSSecurity\NTFSSecurity.psd1` and the
|
|
|
|
|
`AssemblyVersion` and `AssemblyFileVersion` of the `NTFSSecurity`,
|
|
|
|
|
`Security2`, and `PrivilegeControl` projects carry the same version. The
|
|
|
|
|
tests in `Tests\Manifest.Tests.ps1` check this.
|
|
|
|
|
- A prerelease, such as `5.0.0-rc1`, has its label in `Prerelease` under
|
|
|
|
|
`PrivateData.PSData` of the module manifest. Its release notes are the
|
|
|
|
|
`[Unreleased]` section of `CHANGELOG.md`. The PowerShell Gallery installs a
|
|
|
|
|
prerelease only when you add `-AllowPrerelease`.
|
|
|
|
|
- A release, such as `5.0.0`, has no `Prerelease` value. Its release notes
|
|
|
|
|
are the section `## [5.0.0] - <date>` of `CHANGELOG.md`.
|
|
|
|
|
|
|
|
|
|
The tests in `Tests\Release.Tests.ps1` check that `CHANGELOG.md` has the
|
fix: drive roots, audit descriptors, -WhatIf conflicts, and small items
- #41: for the root of a drive, the cmdlets read and changed the security
descriptor of the drive, a device object. FileSystemSecurity2 now routes
drive roots through the path-based AlphaFS methods, which keep the
trailing backslash; the removal and inheritance helpers use it too.
- #109: Add-, Remove-, and Clear-NTFSAudit report a security descriptor
without the audit entries like Get-NTFSAudit, through one helper, and
Get-NTFSEffectiveAccess names the cause that Windows reported instead
of a missing Security privilege.
- #108: Copy-Item2 and Move-Item2 check the destination only for an
operation that runs; with -WhatIf, a verbose message names the conflict.
- #111: Disable-Privileges skips the privileges that the token doesn't
hold, the privilege messages are spelled right, and Get-FileHash2
declares the type name of its objects; 05-Releasing.md documents the
release metadata tests.
- rc3 review leftovers: Remove-NTFSAudit writes nothing for an item
without a SACL, the owner retry of Set-NTFSSecurityDescriptor restores
the previous owner in a finally block and keeps an owner that the
descriptor sets, and FileSystemSecurity2.Write with another item writes
only the sections that were read.
Each fix has a test that failed first, in Windows PowerShell 5.1 and
PowerShell 7; writing a drive root was checked once on a temporary VHD.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
|
|
|
release notes for the version of the module manifest and test the release
|
|
|
|
|
scripts. The tests in `Tests\Repository.Tests.ps1` check the release metadata:
|
|
|
|
|
the description that the PowerShell Gallery shows, that the version isn't one
|
|
|
|
|
that the Gallery already has, and that `Docs/README.md` names no prerelease
|
|
|
|
|
version. Name a prerelease only in `CHANGELOG.md`, because the documentation
|
|
|
|
|
home outlives it.
|
ci: publish releases from CI on a version tag, starting with 5.0.0-rc1
Pushing a tag such as 5.0.0 or 5.0.0-rc1 on master now publishes the
package that the build job built and tested to the PowerShell Gallery
and creates the GitHub release with NTFSSecurity.zip.
- New-ModulePackage.ps1 copies only the FileList files of the Release
build, so no debug symbols, XML documentation, or copy of
System.Management.Automation.dll ship. It builds the nupkg with
Compress-PSResource and adds the command tags (PSIncludes_Cmdlet,
PSCmdlet_*, PSCommand_*) that PSResourceGet leaves out and that the
Gallery uses to list cmdlets and that Find-Command searches. Every CI
run builds and uploads the packages.
- Get-ReleaseInfo.ps1 returns the version and release notes: a dated
CHANGELOG section for a release, the [Unreleased] section for a
prerelease.
- The release job checks that the tag matches the manifest version and
points to a commit on master, reads the API key from the environment
powershell-gallery, and skips steps already done, so a rerun is safe.
- The manifest gets the prerelease label rc1 and a release notes link;
the 5.0.0 changelog entries move back to [Unreleased] until the final
release.
- Tests/Release.Tests.ps1 covers both scripts and the packages; the
changelog check moves there from Manifest.Tests.ps1.
- Docs/Contributing/05-Releasing.md describes the one-time setup and the
release steps; Docs/README.md explains -AllowPrerelease.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
|
|
|
|
|
|
|
|
## Publish a prerelease
|
|
|
|
|
|
|
|
|
|
1. Set the version and the `Prerelease` label, such as `rc1`, and make sure
|
|
|
|
|
that the `[Unreleased]` section of `CHANGELOG.md` describes the changes.
|
|
|
|
|
Add the version that the Gallery has now to `$publishedVersions` in
|
|
|
|
|
`Tests/Repository.Tests.ps1`, so that a test catches a version that is
|
|
|
|
|
reused. Merge the change into `master`.
|
ci: publish releases from CI on a version tag, starting with 5.0.0-rc1
Pushing a tag such as 5.0.0 or 5.0.0-rc1 on master now publishes the
package that the build job built and tested to the PowerShell Gallery
and creates the GitHub release with NTFSSecurity.zip.
- New-ModulePackage.ps1 copies only the FileList files of the Release
build, so no debug symbols, XML documentation, or copy of
System.Management.Automation.dll ship. It builds the nupkg with
Compress-PSResource and adds the command tags (PSIncludes_Cmdlet,
PSCmdlet_*, PSCommand_*) that PSResourceGet leaves out and that the
Gallery uses to list cmdlets and that Find-Command searches. Every CI
run builds and uploads the packages.
- Get-ReleaseInfo.ps1 returns the version and release notes: a dated
CHANGELOG section for a release, the [Unreleased] section for a
prerelease.
- The release job checks that the tag matches the manifest version and
points to a commit on master, reads the API key from the environment
powershell-gallery, and skips steps already done, so a rerun is safe.
- The manifest gets the prerelease label rc1 and a release notes link;
the 5.0.0 changelog entries move back to [Unreleased] until the final
release.
- Tests/Release.Tests.ps1 covers both scripts and the packages; the
changelog check moves there from Manifest.Tests.ps1.
- Docs/Contributing/05-Releasing.md describes the one-time setup and the
release steps; Docs/README.md explains -AllowPrerelease.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: AI Assistant <ai@example.com>
4 weeks ago
|
|
|
2. Tag the commit on `master` with the version and push the tag:
|
|
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
|
git switch master
|
|
|
|
|
git pull
|
|
|
|
|
git tag 5.0.0-rc1
|
|
|
|
|
git push origin 5.0.0-rc1
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3. Watch the CI run of the tag. The **Release** job checks that the tag
|
|
|
|
|
matches the version in the module manifest and points to a commit on
|
|
|
|
|
`master`. Then it publishes the package and creates a GitHub prerelease.
|
|
|
|
|
If the environment requires a reviewer, approve the deployment.
|
|
|
|
|
4. Install the prerelease in a test environment and test it:
|
|
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
|
Install-Module -Name NTFSSecurity -AllowPrerelease -Scope CurrentUser
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
For another prerelease, increase the label, such as `rc2`. The PowerShell
|
|
|
|
|
Gallery compares labels as text, so `rc10` sorts before `rc2`.
|
|
|
|
|
|
|
|
|
|
## Publish a release
|
|
|
|
|
|
|
|
|
|
1. Remove the `Prerelease` value from the module manifest.
|
|
|
|
|
2. In `CHANGELOG.md`, rename `## [Unreleased]` to the version with the
|
|
|
|
|
release date, such as `## [5.0.0] - 2026-10-31`, add an empty
|
|
|
|
|
`## [Unreleased]` section above it, and update the links at the end of the
|
|
|
|
|
file:
|
|
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
|
[Unreleased]: https://github.com/raandree/NTFSSecurity/compare/5.0.0...HEAD
|
|
|
|
|
[5.0.0]: https://github.com/raandree/NTFSSecurity/compare/4.2.6...5.0.0
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
3. Merge the change into `master`. Then tag the commit with the version, such
|
|
|
|
|
as `5.0.0`, and push the tag, as for a prerelease. The **Release** job
|
|
|
|
|
warns if the date in `CHANGELOG.md` isn't the day of the release.
|
|
|
|
|
|
|
|
|
|
## If a release fails
|
|
|
|
|
|
|
|
|
|
The **Release** job skips what's already done: a version that the PowerShell
|
|
|
|
|
Gallery already has, and a GitHub release that already exists. If the
|
|
|
|
|
failure doesn't need a change in the repository, fix the cause and rerun the
|
|
|
|
|
failed job.
|
|
|
|
|
|
|
|
|
|
If the fix needs a change in the repository and the PowerShell Gallery
|
|
|
|
|
doesn't have the version yet, delete the tag, merge the fix, and tag the new
|
|
|
|
|
commit:
|
|
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
|
git push origin --delete 5.0.0-rc1
|
|
|
|
|
git tag --delete 5.0.0-rc1
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The PowerShell Gallery never accepts the same version twice. To replace a
|
|
|
|
|
published version, publish the next one, such as `5.0.0-rc2`, and
|
|
|
|
|
[unlist][unlist] the faulty version.
|
|
|
|
|
|
|
|
|
|
<!-- External URLs -->
|
|
|
|
|
[api-key]: https://learn.microsoft.com/powershell/gallery/how-to/managing-profile/creating-apikeys
|
|
|
|
|
[unlist]: https://learn.microsoft.com/powershell/gallery/how-to/publishing-packages/unlisting-packages
|