Skip to content

Release to PowerShell Gallery #12

Release to PowerShell Gallery

Release to PowerShell Gallery #12

Workflow file for this run

name: Release to PowerShell Gallery
on:
push:
branches:
- main
paths:
- 'GUIDv7/GUIDv7.psd1'
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install newest stable version of PowerShell
shell: bash
run: |
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Get the version of Ubuntu
source /etc/os-release
# Download the Microsoft repository keys
wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb
# Register the Microsoft repository keys
sudo dpkg -i packages-microsoft-prod.deb
# Delete the Microsoft repository keys file
rm packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
###################################
# Install PowerShell
sudo apt-get install -y powershell
- name: Run Build-Module.ps1 script
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
./.github/Build-Module.ps1
- name: Re-Register PowerShell Gallery as Repository
shell: pwsh
run: |
Unregister-PSResourceRepository -Name PSGallery
Register-PSResourceRepository -PSGallery
- name: Publish to PowerShell Gallery
shell: pwsh
run: |
Publish-PSResource -Path ./GUIDv7 -Repository PSGallery -APIKey ${{ secrets.GALLERY_API_KEY }}