natescherer / publish-powershell-action Goto Github PK
View Code? Open in Web Editor NEWA GitHub Action to publish a PowerShell module or script to GitHub Packages, a NuGet repository, or the PowerShell Gallery.
License: MIT License
A GitHub Action to publish a PowerShell module or script to GitHub Packages, a NuGet repository, or the PowerShell Gallery.
License: MIT License
This would allow centralization of more code from release templates.
When publishing to NuGet, If the process encounters an error, it should handle it gracefully and perform cleanup if needed.
I am working to implement this and will create a pull request when ready.
@all-contributors please add @natescherer for code, doc, infra
Hey there. Was just perusing the code and spotted what looks like a potential logic goof in this section.
If the idea is to ensure the existing module version is at least 2.2.5, shouldn't the operator be -lt
rather than -ge
or flip the corresponding blocks around?
I'm also curious if you need the -ListAvailable
switch in the Get-Module
call like you have further down when checking for PSResourceGet. Or do you not because it's already pre-imported by the action?
As of 0.5.22-beta22, PSResourceGet can publish to GH Packages. Should convert action to use that instead of gpr cli.
As discovered in #10, module manifest validation fails if a module has dependencies, and they aren't installed on the local machine (pretty much always going to be true for the Actions runners that this action will be running on).
As a result, I've disabled module manifest validation when the RequiredModules section of a manifest isn't null. According to PowerShell/PSResourceGet#903, this is planned to be fixed in the future version of PSResourceGet, so I'm adding this as a reminder to re-enable this in the future once PSRG is updated.
F7History.psd1
includes:
# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @('Microsoft.PowerShell.ConsoleGuiTools', 'PSReadLine')
When I publish locally with
publish-Module -Path .\F7History\ -NuGetApiKey <key>
It works fine. What am i doing wrong?
name: Publish to PowerShell Gallery
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v2
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Publish PowerShell
uses: natescherer/[email protected]
with:
token: ${{ secrets.F7HISTORY_GALLERY_KEY }}
target: gallery
path: src
PSResourceGet has reached v1, action should be updated and pinned to use any 1.x version.
For nuget and gh packages.
It happened for self hosted runner sometimes, that "Nuget" already registered in PSResourceRepository when trying to publish.
I want to contribute following code and seems I don't have permission to push a new branch.
if ($null -ne (Get-PSResourceRepository -Name "NuGet" -ErrorAction SilentlyContinue)) {
Write-Host "Unregistering existing NuGet repository..."
Unregister-PSResourceRepository -Name "NuGet"
}
Write-Host "Registering NuGet repository..."
Register-PSResourceRepository -Name "NuGet" -Uri $env:INPUT_NUGETURL -Trusted
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.