-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
117 lines (116 loc) · 4.94 KB
/
action.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: "Generate Release Notes"
description: "Generates release notes based upon version information for the current context."
inputs:
mode:
description: "One of 'upload' or 'download'."
required: true
github_token:
description: "The token used to communicate with GitHub. "
required: true
releasenotesmd-name:
description: "The name of the file which will contain the release notes."
required: true
default: 'release-notes.md'
releasenotesmd-artifact-name:
description: "The name of the artifact which will contain the release notes."
required: true
default: 'release-notes'
releasenotesmd-path:
description: "The path of the directory containing the release notes file."
required: true
default: './out'
versionjson-name:
description: "The name of the JSON file containing the generated version information."
required: true
default: 'version.json'
versionjson-artifact-name:
description: "The name of the artifact which contains the JSON file of the generated version information."
required: true
default: 'version-json'
versionjson-path:
description: "The path of the directory containing the JSON file of the generated version information."
required: true
default: './out'
outputs:
releasenotesmd-content:
description: "The content of the release notes."
value: ${{ steps.releasenotes_var.outputs.content }}
releasenotesmd-name:
description: "The name of the file which will contain the release notes."
value: ${{ inputs.releasenotesmd-name }}
releasenotesmd-artifact-name:
description: "The name of the artifact which will contain the release notes."
value: ${{ inputs.releasenotesmd-artifact-name}}
releasenotesmd-filepath:
description: "The path to the file containing the release notes."
value: ${{ steps.calculate_releasenotesmd_filepath.outputs.filepath }}
versionjson-name:
description: "The name of the JSON file containing the generated version information."
value: ${{ steps.gitversion_vars.outputs.versionjson-name }}
versionjson-artifact-name:
description: "The name of the artifact which contains the JSON file of the generated version information."
value: ${{ steps.gitversion_vars.outputs.versionjson-artifact-name }}
versionjson-path:
description: "The path of the directory containing the JSON file of the generated version information."
value: ${{ steps.gitversion_vars.outputs.versionjson-path }}
versionjson-filepath:
description: "The path to the file containing the version information."
value: ${{ steps.gitversion_vars.outputs.versionjson-filepath }}
runs:
using: "composite"
steps:
- name: Check out repository full history
if: inputs.mode == 'upload'
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0 # create-release-notes requires the full history to create the release notes.
- name: Populate GitVersion variables
if: inputs.mode == 'upload'
id: gitversion_vars
uses: pwshrc/actions-determine-version@v0.8.7
with:
mode: 'download'
versionjson-name: "${{ inputs.versionjson-name }}"
versionjson-path: "${{ inputs.versionjson-path }}"
versionjson-artifact-name: "${{ inputs.versionjson-artifact-name }}"
- name: Calculate file path
id: calculate_releasenotesmd_filepath
shell: pwsh
env:
filename: "${{ inputs.releasenotesmd-name }}"
directory: "${{ inputs.releasenotesmd-path }}"
run: |
[string] $filePath = Join-Path $Env:directory $Env:filename
echo "::set-output name=filepath::$filePath"
- name: Create release notes
if: inputs.mode == 'upload'
id: create_release_notes
uses: mikepenz/release-changelog-builder-action@v4
env:
GITHUB_TOKEN: "${{ inputs.github_token }}"
with:
fromTag: "${{ steps.gitversion_vars.outputs.VersionSourceSha }}"
toTag: "${{ steps.gitversion_vars.outputs.Sha }}"
commitMode: true
outputFile: "${{ steps.calculate_releasenotesmd_filepath.outputs.filepath }}"
- name: "Create artifact: ${{ inputs.releasenotesmd-artifact-name }}"
if: inputs.mode == 'upload'
uses: actions/upload-artifact@v3
with:
name: "${{ inputs.releasenotesmd-artifact-name }}"
path: "${{ steps.calculate_releasenotesmd_filepath.outputs.filepath }}"
if-no-files-found: error
- name: "Get artifact: ${{ inputs.releasenotesmd-artifact-name }}"
if: inputs.mode == 'download'
uses: actions/download-artifact@v3
with:
name: "${{ inputs.releasenotesmd-artifact-name }}"
path: "${{ inputs.releasenotesmd-path }}"
- name: "Populate releasenotes variable"
id: releasenotes_var
shell: pwsh
env:
filePath: "${{ steps.calculate_releasenotesmd_filepath.outputs.filepath }}"
run: |
[string] $releaseNotesContent = Get-Content -Raw $Env:filePath -Encoding UTF8
echo "content<<EOF`n${releaseNotesContent}`nEOF" | Out-File -Path $Env:GITHUB_OUTPUT -Encoding UTF8