@@ -5,21 +5,55 @@ name: Create Release
5
5
# Controls when the action will run. Workflow runs when manually triggered using the UI
6
6
# or API.
7
7
on :
8
+ push :
9
+ branches :
10
+ - gh-pages
11
+ tags :
12
+ - v*
8
13
workflow_dispatch :
9
14
# Inputs the workflow accepts.
10
15
inputs :
11
16
release :
12
17
description : ' Release Version'
13
- # Input has to be provided for the workflow to run
14
- required : true
18
+ default : ' latest'
19
+ workflow_call :
20
+ outputs :
21
+ release :
22
+ description : " Release Version"
23
+ value : ${{ jobs.get_release.outputs.release }}
15
24
16
25
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17
26
jobs :
27
+ get_release :
28
+ # The type of runner that the job will run on
29
+ runs-on : ubuntu-latest
30
+ env :
31
+ GH_TOKEN : ${{ github.token }}
32
+
33
+ # Steps represent a sequence of tasks that will be executed as part of the job
34
+ steps :
35
+ - name : Checkout
36
+
37
+ with :
38
+ ref : gh-pages
39
+
40
+ - name : Get Latest Release
41
+ id : get_latest_release
42
+ if : github.event.inputs.release == 'latest'
43
+ run : echo "release=$(git describe --abbrev=0)" >> "$GITHUB_OUTPUT"
44
+
45
+ - name : Get Specified Release
46
+ id : get_specified_release
47
+ if : ${{ failure() }}
48
+ run : echo "release=${{ github.event.inputs.release }}" >> "$GITHUB_OUTPUT"
49
+
18
50
create_release :
19
51
# The type of runner that the job will run on
20
52
runs-on : ubuntu-latest
53
+ needs : get_release
21
54
env :
22
55
GH_TOKEN : ${{ github.token }}
56
+ RELEASE : $
23
57
24
58
# Steps represent a sequence of tasks that will be executed as part of the job
25
59
steps :
31
65
- name : Zip Release
32
66
uses :
TheDoctor0/[email protected]
33
67
with :
34
- filename : ui-grid-${{ github.event.inputs.release }} .zip
35
- path : ./release/${{ github.event.inputs.release }} /*
68
+ filename : ui-grid-$RELEASE .zip
69
+ path : ./release/$RELEASE /*
36
70
37
71
- name : Publish Release
38
- run : gh release create v${{ github.event.inputs.release }} . /ui-grid-${{ github.event.inputs.release }} .zip
72
+ run : gh release create v$RELEASE . /ui-grid-$RELEASE .zip
39
73
0 commit comments