-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (46 loc) · 1.59 KB
/
publish.yml
File metadata and controls
54 lines (46 loc) · 1.59 KB
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
name: Publish to PowerShell Gallery
on:
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [main]
workflow_dispatch:
permissions:
contents: read
actions: read
concurrency:
group: publish-powershell-gallery
cancel-in-progress: true
jobs:
publish:
name: Publish module
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
sparse-checkout: |
.build/Invoke-PublishModule.ps1
src
sparse-checkout-cone-mode: false
- name: Get module name
id: module
shell: pwsh
run: |
$manifest = Get-ChildItem -Path src -Filter '*.psd1' -Recurse | Select-Object -First 1
$moduleName = [System.IO.Path]::GetFileNameWithoutExtension($manifest.Name)
echo "name=$moduleName" >> $env:GITHUB_OUTPUT
- name: Download module artifact
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e
with:
name: ${{ steps.module.outputs.name }}-Module
path: Artifacts/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PowerShell Gallery
shell: pwsh
env:
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
run: ./.build/Invoke-PublishModule.ps1 -ModuleName ${{ steps.module.outputs.name }} -ArtifactPath Artifacts