-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
112 lines (99 loc) · 2.76 KB
/
action.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: 'releases-x'
description: 'Publish Github releases'
author: "milankomaj"
branding:
icon: "x-square"
color: "green"
inputs:
GITHUB_TOKEN: # id of input
description: 'Use GITHUB_TOKEN'
required: true
default: ''
target : # id of input
description: 'Use target branch'
required: false
default: master
title: # id of input
description: 'Use title'
required: false
default: ${{ github.repository }}
tag: # id of input
description: 'Use tag'
required: false
default: v.0.${{ github.run_id }}.${{runner.os}}
files: # id of input
description: 'Use files'
required: false
default: ''
rewrite: # id of input
description: 'Use rewrite'
required: false
default: false
type: boolean
runs:
using: "composite"
steps:
- name: inputs.GITHUB_TOKEN
id: GITHUB_TOKEN
if: inputs.GITHUB_TOKEN
run: echo "GITHUB_TOKEN=$(echo ${{ inputs.GITHUB_TOKEN }})" >> $GITHUB_ENV
shell: bash
- name: inputs.target
id: target
if: inputs.target
run: echo "target=$(echo ${{ inputs.target }})" >> $GITHUB_ENV
shell: bash
- name: inputs.title
id: title
if: inputs.title
run: echo "title=$(echo ${{ inputs.title }})" >> $GITHUB_ENV
shell: bash
- name: inputs.tag
id: tag
if: inputs.tag
run: echo "tag=$(echo ${{ inputs.tag }})" >> $GITHUB_ENV
shell: bash
- name: inputs.files
id: files
if: inputs.files
run: echo "files=$(echo ${{ inputs.files }})" >> $GITHUB_ENV
shell: bash
- name: count
id: count
run: |
count=$(gh api repos/${{ github.repository }}/releases --jq length)
echo "count=$(echo $count)" >> $GITHUB_ENV
shell: bash
- name: view
id: view
if: env.count != '0'
run: |
gh release view
last_relase=$(gh release view --json tagName --jq .tagName)
echo "last_relase=$(echo $last_relase)" >> $GITHUB_ENV
shell: bash
- name: rewrite
id: rewrite
if: inputs.rewrite == 'true' && env.count != '0'
run: gh release delete ${{ env.last_relase }} --cleanup-tag --yes
shell: bash
- name: create
id: create
if: ${{ always() }}
run: |
gh release create \
${{ env.tag }} \
${{ env.files }} \
--target ${{ env.target }} \
--generate-notes \
--title ${{ env.title }}
new_relase=$(gh release view --json tagName --jq .tagName)
echo "new_relase=$(echo $new_relase)" >> $GITHUB_ENV
shell: bash
- name: release
id: release
run: |
echo $GITHUB_ENV
echo '### release :relaxed:' >> $GITHUB_STEP_SUMMARY
echo "$(gh release view)" >> $GITHUB_STEP_SUMMARY
shell: bash