-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (72 loc) · 3.01 KB
/
Copy pathPublish-Module.yml
File metadata and controls
79 lines (72 loc) · 3.01 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Publish-Module
on:
workflow_call:
secrets:
APIKey:
description: The API key for the PowerShell Gallery.
required: true
GitHubAppClientId:
description: The client ID of the GitHub App used for repository API calls.
required: true
GitHubAppPrivateKey:
description: The private key of the GitHub App used for repository API calls.
required: true
inputs:
Settings:
type: string
description: The complete settings object.
required: true
permissions:
contents: write # to checkout the repo, create releases, and upload release artifacts
pull-requests: write # to comment on PRs
jobs:
Publish-Module:
name: Publish-Module
runs-on: ubuntu-latest
env:
SETTINGS: ${{ inputs.Settings }}
steps:
- name: Checkout Code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
fetch-depth: 0
- name: Checkout Process-PSModule
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
path: _wf
persist-credentials: false
- name: Create GitHub App token
id: App-Token
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
with:
app-id: ${{ secrets.GitHubAppClientId }}
private-key: ${{ secrets.GitHubAppPrivateKey }}
repositories: ${{ github.event.repository.name }}
permission-contents: write
permission-pull-requests: write
- name: Publish module
if: fromJson(inputs.Settings).Publish.Module.Resolution.ReleaseType != 'None'
uses: ./_wf/.github/actions/Publish-PSModule
env:
GH_TOKEN: ${{ steps.App-Token.outputs.token }}
with:
Name: ${{ fromJson(inputs.Settings).Name }}
ModulePath: outputs/module
APIKey: ${{ secrets.APIKey }}
WhatIf: ${{ github.repository == 'PSModule/Process-PSModule' }}
UsePRTitleAsReleaseName: ${{ fromJson(inputs.Settings).Publish.Module.UsePRTitleAsReleaseName }}
UsePRBodyAsReleaseNotes: ${{ fromJson(inputs.Settings).Publish.Module.UsePRBodyAsReleaseNotes }}
UsePRTitleAsNotesHeading: ${{ fromJson(inputs.Settings).Publish.Module.UsePRTitleAsNotesHeading }}
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}
- name: Cleanup prereleases
if: fromJson(inputs.Settings).Publish.Module.Resolution.ReleaseType != 'Prerelease'
uses: ./_wf/.github/actions/Cleanup-PSModulePrereleases
env:
GH_TOKEN: ${{ steps.App-Token.outputs.token }}
with:
WhatIf: ${{ github.repository == 'PSModule/Process-PSModule' }}
AutoCleanup: ${{ fromJson(inputs.Settings).Publish.Module.AutoCleanup }}
WorkingDirectory: ${{ fromJson(inputs.Settings).WorkingDirectory }}