-
-
Notifications
You must be signed in to change notification settings - Fork 7
57 lines (50 loc) · 2.25 KB
/
publish-on-release.yml
File metadata and controls
57 lines (50 loc) · 2.25 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
55
56
57
# File: .github/workflows/qa.yml
on:
release:
types:
- "published"
workflow_dispatch:
name: Publish Module to PSGallery
jobs:
publish:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PSRule module
shell: pwsh
run: |
Install-Module -Name PSRule -Force -Scope CurrentUser -Repository PSGallery
# Update the module manifest for preview-release
- name: Update the module manifest for preview-release
if: github.event.release.prerelease == true
shell: pwsh
run: |
# Update the module manifest with the version number in the release tag
$version = ($env:GITHUB_REF -replace 'refs/tags/v','') -split '-' | Select-Object -First 1
$prerelease = "-" + (($env:GITHUB_REF -replace 'refs/tags/v') -split '-' | Select-Object -Last 1)
$path = './src/PSRule.Rules.AzureDevOps/PSRule.Rules.AzureDevOps.psd1'
Update-ModuleManifest -Path $path -ModuleVersion $version -ReleaseNotes "${{ github.event.release.body }}" -Prerelease $prerelease
# Update the module manifest for full-release
- name: Update the module manifest for full-release
if: github.event.release.prerelease == false
shell: pwsh
run: |
# Update the module manifest with the version number in the release tag
$version = $env:GITHUB_REF -replace 'refs/tags/v'
$path = './src/PSRule.Rules.AzureDevOps/PSRule.Rules.AzureDevOps.psd1'
Update-ModuleManifest -Path $path -ModuleVersion $version -ReleaseNotes "${{ github.event.release.body }}"
# Publish to PowerShell Gallery on pre-release
- name: Publish preview module
if: github.event.release.prerelease == true
shell: pwsh
id: publish-module-preview
run: |
Publish-Module -Path ./src/PSRule.Rules.AzureDevOps -NuGetApiKey ${{ secrets.PS_GALLERY_KEY }} -Repository PSGallery
# Publish to PowerShell Gallery on full-release
- name: Publish module
if: github.event.release.prerelease == false
shell: pwsh
id: publish-module
run: |
Publish-Module -Path ./src/PSRule.Rules.AzureDevOps -NuGetApiKey ${{ secrets.PS_GALLERY_KEY }}