generated from jmeridth/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (58 loc) · 1.9 KB
/
release.yaml
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
---
name: "Release"
on:
workflow_call:
inputs:
publish:
required: false
type: boolean
default: true
release-config-name:
required: true
type: string
secrets:
github-token:
required: true
outputs:
full-tag:
description: 'Full tag of release'
value: ${{ jobs.create_release.outputs.full-tag }}
short-tag:
description: 'Short tag of release'
value: ${{ jobs.create_release.outputs.short-tag }}
body:
description: 'Body content of release'
value: ${{ jobs.create_release.outputs.body }}
jobs:
create_release:
# release if
# manual deployment OR
# merged to main and labelled with release labels
if: |
(github.event_name == 'workflow_dispatch') ||
(github.event.pull_request.merged == true &&
(contains(github.event.pull_request.labels.*.name, 'breaking') ||
contains(github.event.pull_request.labels.*.name, 'feature') ||
contains(github.event.pull_request.labels.*.name, 'vuln') ||
contains(github.event.pull_request.labels.*.name, 'release')))
outputs:
full-tag: ${{ steps.release-drafter.outputs.tag_name }}
short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }}
body: ${{ steps.release-drafter.outputs.body }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps:
- uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5
id: release-drafter
env:
GITHUB_TOKEN: ${{ secrets.github-token }}
with:
config-name: ${{ inputs.release-config-name }}
publish: ${{ inputs.publish }}
- name: Get the Short Tag
id: get_tag_name
run: |
short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1)
echo "SHORT_TAG=$short_tag" >> "$GITHUB_OUTPUT"