-
Notifications
You must be signed in to change notification settings - Fork 23
72 lines (61 loc) · 3 KB
/
PS_Gallery_Pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# This workflow publishes new modules to PSGallery on pull requests that close on the master branch.
name: PSGallery Publish
# Controls when the action will run.
on: # Triggers the workflow on push or pull request events but only for the master branch
#push:
#branches: [ master ]
pull_request:
branches:
- master
types:
- closed
workflow_run:
workflows: ["Version Bump"]
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-2019
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
#Cache Modules that are required by publishing modules
- name: Specify PowerShell modules to cache
id: psmodulecache
uses: potatoqualitee/[email protected]
with:
modules-to-cache: ImportExcel, Posh-SSH, PSEventViewer, PSNmap, VMware.Vim, VMware.VimAutomation.Cis.Core, VMware.VimAutomation.Common, VMware.VimAutomation.Core, VMware.VimAutomation.Sdk
#Run pwsh functions to publish the module
- name: Install Required Modules, Update Manifests, Publish updated Modules, and commit manifest changes
env:
NUGET_KEY: ${{ secrets.PS_GALLERY_KEY }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
shell: pwsh
run: |
# Attempt to resolve future nuget issues observed on 2023/03/15
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile "$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe"
Install-module powershellget -force -Allowclobber
Import-Module powershellget
#Impoort Modules
Get-Module ImportExcel, Posh-SSH, PSEventViewer, PSNmap, VMware.Vim, VMware.VimAutomation.Cis.Core, VMware.VimAutomation.Common, VMware.VimAutomation.Core, VMware.VimAutomation.Sdk | Import-Module
#Set-PSRepository PSGallery -InstallationPolicy Trusted
#Install-Module PSEventViewer -Force -Allowclobber
#Install-Module Posh-SSH -Force -Allowclobber -AllowPrerelease
#Install-Module -Name VMware.VimAutomation.Core -Force
#Import and Run Scripts
$workingdirectory = (Get-Location).path
. "$workingdirectory\.github\workflows\scripts\New-Manifest.ps1"
. "$workingdirectory\.github\workflows\scripts\Invoke-PublishModules.ps1"
Invoke-PublishModules
#Publish new manifest files to the repository
git config --global user.email $env:GIT_EMAIL
git config --global user.name "TheTaylorLee"
git add -A
git commit -m "rel: Manifest Update"
git push -u origin master