Skip to content

Commit 0093e1b

Browse files
xt0rtedljharb
authored andcommitted
[actions] add release workflow
1 parent d9531c3 commit 0093e1b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/release.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
release:
10+
if: github.event.repository.fork == false
11+
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- uses: step-security/harden-runner@v1
19+
with:
20+
allowed-endpoints:
21+
api.github.com:443
22+
github.com:443
23+
24+
- name: Get version from tag
25+
id: tag_name
26+
run: echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
27+
shell: bash
28+
29+
- uses: actions/checkout@v2
30+
31+
- uses: mindsers/changelog-reader-action@v2
32+
id: changelog_reader
33+
with:
34+
version: ${{ steps.tag_name.outputs.current_version }}
35+
36+
- name: Get common links from changelog
37+
id: changelog
38+
run: |
39+
# Parse the changelog for common links
40+
_links="$(grep -P '^\[.*]:.+' ${GITHUB_WORKSPACE}/CHANGELOG.md | sort -u)"
41+
_links="${_links//'%'/'%25'}"
42+
_links="${_links//$'\n'/'%0A'}"
43+
_links="${_links//$'\r'/'%0D'}"
44+
# Set output 'links' to $_links
45+
echo "::set-output name=links::${_links}"
46+
47+
- uses: softprops/action-gh-release@v1
48+
with:
49+
body: |
50+
${{ steps.changelog_reader.outputs.changes }}
51+
${{ steps.changelog.outputs.links }}

0 commit comments

Comments
 (0)