-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (46 loc) · 1.43 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
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
github-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/github-script@v6
id: get-version
with:
result-encoding: string
script: |
const major = process.env.GITHUB_REF_NAME.substring(1, 2)
const fullVersion = process.env.GITHUB_REF_NAME.substring(1)
core.setOutput('major', major)
core.setOutput('full', fullVersion)
- uses: actions/github-script@v6
id: extract-changelog
env:
VERSION_MAJOR: '${{ steps.get-version.outputs.major }}'
VERSION_FULL: '${{ steps.get-version.outputs.full }}'
with:
result-encoding: string
script: |
const file = `docs/changelog/${process.env.VERSION_MAJOR}/${process.env.VERSION_FULL}.md`
let output = ''
const options = {
listeners: {
stdout: (data: Buffer) => {
output += data.toString('utf8')
}
}
}
await exec.exec(`cat ${file} | tail -n +5`)
core.setOutput('markdown', output.trim())
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body: |
## Changelog
${{ steps.extract-changelog.outputs.markdown }}