-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
322 lines (310 loc) · 15.3 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
name: Release Publish Notify Please
description: "Release your SDK to multiple package managers fully automatically, including notifications."
author: DX Heroes (https://www.dxheroes.io)
branding:
icon: zap
color: green
inputs:
package-name:
description: "Name of the package to release"
required: true
release-type:
description: "Type of package to release"
required: true
default: node # Possible values: [test, node]
package-path:
description: "Path to the package to release"
required: false
default: .
node-version:
description: "The version of node to use for publishing to npmjs.com"
required: false
default: latest
# release-please action parameters https://github.com/google-github-actions/release-please-action/blob/main/action.yml
token:
description: "GitHub token for creating and grooming release PRs, defaults to using secrets.GITHUB_TOKEN"
default: ${{ github.token }}
fork:
description: "should the PR be proposed from a fork, Default to false"
default: "false"
clean:
description: "Should stale release PRs be closed post release? Defaults to true"
default: "true"
bump-minor-pre-major:
description: "should breaking changes before 1.0.0 produce minor bumps"
default: "false"
bump-patch-for-minor-pre-major:
description: "should feat changes before 1.0.0 produce patch bumps instead of minor bumps"
default: "false"
path:
description: "create a release from a path other than the repository's root"
default: ""
changelog-path:
description: "specify a CHANGELOG path other than the root CHANGELOG.md"
default: ""
changelog-host:
description: "The proto://host where commits live."
default: ${{ github.server_url }}
command:
description: 'release-please command to run, either "github-release", or "release-pr" (defaults to running both)'
default: ""
version-file:
description: "provide a path to a version file to increment (used by ruby releaser)"
default: ""
extra-files:
description: "extra files to bump using the generic updater"
default: ""
default-branch:
description: "branch to open pull release PR against (detected by default)"
default: ""
changelog-types:
description: "changlelog commit types"
default: ""
config-file:
description: "where can the config file be found in the project?"
default: ""
manifest-file:
description: "where can the manifest file be found in the project?"
default: ""
signoff:
description: 'Add [`Signed-off-by`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) line at the end of the commit log message using the user and email provided. (format "Name \<[email protected]\>")'
default: ""
github-api-url:
description: "configure github API URL. Default `https://api.github.com`"
default: ${{ github.api_url }}
github-graphql-url:
description: "configure github GraphQL URL. Default `https://api.github.com`"
default: ${{ github.graphql_url }}
repo-url:
description: "configure github repository URL. Default `process.env.GITHUB_REPOSITORY`"
default: ""
monorepo-tags:
description: "add prefix to tags and branches, allowing multiple libraries to be released from the same repository"
default: "false"
# pull-request-title-pattern:
# description: 'add title pattern to make release PR, defaults to using "chore${scope}: release${component} ${version}"'
pull-request-header:
description: 'set release PR header, defaults to using ":robot: I have created a release *beep* *boop*"'
draft:
description: "mark release as a draft"
draft-pull-request:
description: "mark pull request as a draft"
changelog-notes-type:
description: "Strategy for building the changelog contents(see https://github.com/googleapis/release-please/blob/main/docs/customizing.md#changelog-types). Default `default`. Called `changelog-type` in release-please documentation."
versioning-strategy:
description: "Override method of determining SemVer version bumps based on commits (drr https://github.com/googleapis/release-please/blob/main/docs/customizing.md#versioning-strategies). Default `default`"
release-as:
description: "manually set version to this value, ignoring conventional commits. Absence defaults to conventional commits derived next version. Once the release PR is merged you should either remove this or update it to a higher version. Otherwise subsequent `manifest-pr` runs will continue to use this version even though it was already set in the last release."
skip-github-release:
description: "Skip creating GitHub Releases. Default `false`"
prerelease:
description: "If set, create releases that are pre-major or pre-release version marked as pre-release on Github. Defaults `false`"
component:
description: "name of the component used for branch naming and release tagging, defaults to a normalized version based on the package name"
include-v-in-tag:
description: 'include "v" in tag versions. Default `true`'
tag-separator:
description: "configures separator character used in release tag"
snapshot-labels:
description: "sets java snapshot pull request labels other than `autorelease: snapshot` "
bootstrap-sha:
description: "if this is the first time running `manifest-pr` on a repo this key will limit how far back (exclusive) to pull commits for conventional commit parsing (see the manifest releaser docs https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md)"
last-release-sha:
description: "overrides the commit sha release-please will use from which to gather commits for the current release (see the manifest releaser docs https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md)"
always-link-local:
description: "when using the `node-workspace` plugin, setting to false will only bump your local dependencies within the SemVer range (see the manifest releaser docs)[https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md) . Default `true`."
separate-pull-requests:
description: "create separate pull requests for each package instead of a single manifest release pull request (see the manifest releaser docs https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md). Default `false`."
plugins:
description: "see https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md#plugins"
labels:
description: "list of labels to apply to the release pull requests, defaults to `autorelease: pending`"
release-labels:
description: "set a pull request label other than `autorelease: tagged`"
skip-labeling:
description: "if set, labels will not be applied to pull requests. Default `false`."
sequential-calls:
description: "issue GitHub API requests sequentially rather than concurrently (see the manifest releaser docs https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md). Default `false`"
group-pull-request-title-pattern:
description: "sets the manifest pull request title for when releasing multiple packages grouped together in the one pull request"
release-search-depth:
description: "when searching for the latest release SHAs, only consider the last N releases"
commit-search-depth:
description: "when fetching the list of commits to consider, only consider the last N commits"
proxy-server:
description: "set proxy sever when you run this action behind a proxy. format is host:port e.g. proxy-host.com:8080"
outputs:
package-manager-link:
description: "Link to the package manager where the package was published"
value: ${{ steps.package-manager-link.outputs.package-manager-link }}
major:
description: "Major version of the package"
value: ${{ steps.release-please.outputs.major }}
minor:
description: "Minor version of the package"
value: ${{ steps.release-please.outputs.minor }}
patch:
description: "Patch version of the package"
value: ${{ steps.release-please.outputs.patch }}
release_created:
description: "Whether a release was created"
value: ${{ steps.release-please.outputs.release_created }}
sha:
description: "SHA of the release"
value: ${{ steps.release-please.outputs.sha }}
pr:
description: "PR number of the release"
value: ${{ steps.release-please.outputs.pr }}
prs:
description: "PR numbers of the release"
value: ${{ steps.release-please.outputs.prs }}
upload_url:
description: "Upload URL of the release"
value: ${{ steps.release-please.outputs.upload_url }}
html_url:
description: "HTML URL of the release"
value: ${{ steps.release-please.outputs.html_url }}
tag_name:
description: "Tag name of the release"
value: ${{ steps.release-please.outputs.tag_name }}
runs:
using: "composite"
steps:
- uses: actions/checkout@v3
# Validate the action parameters
- name: GH Action Validation
run: "node ${{ github.action_path }}/dist/index.js --package-name ${{ inputs.package-name }} --release-type ${{ inputs.release-type }}"
shell: bash
# Processing the package release with release-please
- name: release-please
id: release-please
uses: google-github-actions/release-please-action@v3
with:
release-type: ${{ inputs.release-type }}
package-name: ${{ inputs.package-name }}
token: ${{ inputs.token }}
fork: ${{ inputs.fork }}
clean: ${{ inputs.clean }}
bump-minor-pre-major: ${{ inputs.bump-minor-pre-major }}
bump-patch-for-minor-pre-major: ${{ inputs.bump-patch-for-minor-pre-major }}
path: ${{ inputs.path }}
changelog-path: ${{ inputs.changelog-path }}
changelog-host: ${{ inputs.changelog-host }}
command: ${{ inputs.command }}
version-file: ${{ inputs.version-file }}
extra-files: ${{ inputs.extra-files }}
default-branch: ${{ inputs.default-branch }}
changelog-types: ${{ inputs.changelog-types }}
config-file: ${{ inputs.config-file }}
manifest-file: ${{ inputs.manifest-file }}
signoff: ${{ inputs.signoff }}
github-api-url: ${{ inputs.github-api-url }}
github-graphql-url: ${{ inputs.github-graphql-url }}
repo-url: ${{ inputs.repo-url }}
monorepo-tags: ${{ inputs.monorepo-tags }}
# pull-request-title-pattern: ${{ inputs.pull-request-title-pattern }}
pull-request-title-pattern: "chore(release): ${version}"
pull-request-header: ${{ inputs.pull-request-header }}
draft: ${{ inputs.draft }}
draft-pull-request: ${{ inputs.draft-pull-request }}
changelog-notes-type: ${{ inputs.changelog-notes-type }}
versioning-strategy: ${{ inputs.versioning-strategy }}
release-as: ${{ inputs.release-as }}
skip-github-release: ${{ inputs.skip-github-release }}
prerelease: ${{ inputs.prerelease }}
component: ${{ inputs.component }}
include-v-in-tag: ${{ inputs.include-v-in-tag }}
tag-separator: ${{ inputs.tag-separator }}
snapshot-labels: ${{ inputs.snapshot-labels }}
bootstrap-sha: ${{ inputs.bootstrap-sha }}
last-release-sha: ${{ inputs.last-release-sha }}
always-link-local: ${{ inputs.always-link-local }}
separate-pull-requests: ${{ inputs.separate-pull-requests }}
plugins: ${{ inputs.plugins }}
labels: ${{ inputs.labels }}
release-labels: ${{ inputs.release-labels }}
skip-labeling: ${{ inputs.skip-labeling }}
sequential-calls: ${{ inputs.sequential-calls }}
group-pull-request-title-pattern: ${{ inputs.group-pull-request-title-pattern }}
release-search-depth: ${{ inputs.release-search-depth }}
commit-search-depth: ${{ inputs.commit-search-depth }}
proxy-server: ${{ inputs.proxy-server }}
# # ref: https://github.com/orgs/community/discussions/41927#discussioncomment-4605881
- name: Symlink current Actions repo
env:
GH_ACTION_REPO: ${{ github.action_repository }}
GH_ACTION_REF: ${{ github.action_ref }}
shell: bash
run: ln -s /home/runner/work/_actions/$GH_ACTION_REPO/$GH_ACTION_REF/ /home/runner/work/_actions/current
# Publishing the package to npmjs.com if the release is a node package
- name: Publish to npmjs.com
if: contains(github.event.head_commit.message, 'chore(release)') && inputs.release-type == 'node'
uses: ./../../_actions/current/.github/actions/publish-node-npm
with:
package-path: ${{ inputs.package-path }}
node-version: ${{ inputs.node-version }}
env:
NPM_TOKEN: ${{ env.NPM_TOKEN }}
# Publishing the package to rubygems.org if the release is a ruby package
- name: Publish to rubygems.org
if: contains(github.event.head_commit.message, 'chore(release)') && inputs.release-type == 'ruby'
uses: ./../../_actions/current/.github/actions/publish-ruby-rubygems
with:
package-path: ${{ inputs.package-path }}
env:
RUBYGEMS_API_KEY: ${{ env.RUBYGEMS_API_KEY }}
# Publishing the package to packagist.org if the release is a php package
- name: Publish to packagist.org
if: contains(github.event.head_commit.message, 'chore(release)') && inputs.release-type == 'php'
uses: ./../../_actions/current/.github/actions/publish-php-packagist
with:
package-path: ${{ inputs.package-path }}
env:
PACKAGIST_USERNAME: ${{ env.PACKAGIST_USERNAME }}
PACKAGIST_TOKEN: ${{ env.PACKAGIST_TOKEN }}
# TODO: Add publishing to other package managers
# ...
- name: Prepare link to package manager for Slack message
if: contains(github.event.head_commit.message, 'chore(release)')
id: package-manager-link
run: "node ${{ github.action_path }}/dist/setLink/index.js --release-type ${{ inputs.release-type }} --package-name ${{ inputs.package-name }} --github-org ${{ github.repository_owner }}"
shell: bash
# Send a Slack notification about the release
- name: Slack Notification
id: slack
if: contains(github.event.head_commit.message, 'chore(release)') && env.SLACK_WEBHOOK_URL != null
uses: slackapi/slack-github-action@v1
with:
# For posting a rich message using Block Kit
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Your package <*${{ steps.package-manager-link.outputs.package-manager-link }}@${{ steps.release-please.outputs.major }}.${{ steps.release-please.outputs.minor }}.${{ steps.release-please.outputs.patch }}*> has been released!"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://raw.githubusercontent.com/DXHeroes/gh-action-auto-release/main/docs/dxh.png",
"alt_text": "images"
},
{
"type": "mrkdwn",
"text": "Author: DX Heroes"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ env.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK