-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
71 lines (57 loc) · 1.87 KB
/
release.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
name: release
on:
workflow_dispatch:
inputs:
version:
description: 'The version to create the release for.'
required: true
type: string
permissions: {}
jobs:
release:
runs-on: [ ubuntu-latest ]
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: write
issues: write
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Create release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
VERSION: ${{ inputs.version }}
with:
script: |
const { repo, owner } = context.repo;
const draft = true;
let version = process.env.VERSION;
if (version.startsWith('v')) {
version = version.slice(1);
}
const tag_name = version;
const name = tag_name;
const { data: notes } = await github.rest.repos.generateReleaseNotes({
owner,
repo,
tag_name,
target_commitish: process.env.DEFAULT_BRANCH,
});
const body = notes.body
.split('\n')
.filter((line) => !line.includes(' @dependabot '))
.filter((line) => !line.includes(' @github-actions '))
.filter((line) => !line.includes(' @polly-updater-bot '))
.join('\n');
const { data: release } = await github.rest.repos.createRelease({
owner,
repo,
tag_name,
name,
body,
draft,
});
core.notice(`Created release ${release.name}: ${release.html_url}`);