-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (61 loc) · 2.3 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
name: Semantic Release
on:
push:
branches:
- main
jobs:
semantic-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
token: ${{ secrets.GH_TOKEN }}
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
dry_run: false
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/exec
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
token: ${{ secrets.GH_TOKEN }}
ref: 'v${{ steps.semantic.outputs.new_release_version }}'
- name: Get Notes
if: steps.semantic.outputs.new_release_published == 'true'
id: get_notes
run: |
NOTES=$(git show -1 --no-notes --no-patch | tail +9 | sed -e 's/^[[:space:]]*//')
echo "${NOTES}"
NOTES="${NOTES//'%'/'%25'}"
NOTES="${NOTES//$'\n'/'%0A'}"
NOTES="${NOTES//$'\r'/'%0D'}"
echo ::set-output name=NOTES::"${NOTES}"
- name: Create Release
if: steps.semantic.outputs.new_release_published == 'true'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: 'v${{ steps.semantic.outputs.new_release_version }}'
release_name: 'v${{ steps.semantic.outputs.new_release_version }}'
draft: true
body: ${{ steps.get_notes.outputs.NOTES }}
- name: Dispatch build-trigger
if: steps.semantic.outputs.new_release_published == 'true'
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GH_TOKEN }}
event-type: build-trigger
client-payload: '{"ref": "v${{ steps.semantic.outputs.new_release_version }}", "sha": "${{ github.sha }}", "release": { "id": "${{ steps.create_release.outputs.id }}", "html_url": "${{ steps.create_release.outputs.html_url }}", "upload_url": "${{ steps.create_release.outputs.upload_url }}" }}'