@@ -3,45 +3,23 @@ name: "[M] Plugin and CLI: publish as archives"
3
3
on :
4
4
workflow_call :
5
5
inputs :
6
- minor-release :
7
- type : string
8
- description : " It adds minor release indicator to version."
9
- required : false
10
- default : ' none'
11
- version-postfix :
12
- type : string
13
- description : " It adds postfix (alpha or beta) to version (optional)."
14
- required : false
15
- default : no-postfix
16
6
upload-artifact :
17
7
type : string
18
8
description : " Upload artifacts or not"
19
9
required : false
20
10
default : false
11
+ commit_sha :
12
+ required : false
13
+ type : string
14
+ description : " (optional) Commit SHA"
15
+ custom_version :
16
+ type : string
17
+ description : " Custom version"
18
+ required : false
19
+ default : " "
21
20
22
21
workflow_dispatch :
23
22
inputs :
24
- minor-release :
25
- type : choice
26
- description : " It adds minor release indicator to version."
27
- required : true
28
- default : ' none'
29
- options :
30
- - ' none'
31
- - ' 1'
32
- - ' 2'
33
- - ' 3'
34
- - ' 4'
35
- version-postfix :
36
- type : choice
37
- description : " It adds alpha or beta postfix to version."
38
- required : true
39
- default : no-postfix-prod
40
- options :
41
- - no-postfix-prod
42
- - no-postfix
43
- - alpha
44
- - beta
45
23
upload-artifact :
46
24
type : choice
47
25
description : " Upload artifacts or not"
50
28
options :
51
29
- true
52
30
- false
31
+ commit_sha :
32
+ required : false
33
+ type : string
34
+ description : " (optional) Commit SHA"
35
+ custom_version :
36
+ type : string
37
+ description : " Custom version"
38
+ required : false
39
+ default : " "
53
40
54
41
jobs :
55
42
publish_plugin_and_cli :
@@ -65,25 +52,25 @@ jobs:
65
52
container : unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
66
53
steps :
67
54
- uses : actions/checkout@v3
55
+ - name : Check out ${{ github.event.inputs.commit_sha }} commit
56
+ if : github.event.inputs.commit_sha != ''
57
+ run : |
58
+ git config --global --add safe.directory ${GITHUB_WORKSPACE}
59
+ git fetch
60
+ git checkout ${{ github.event.inputs.commit_sha }}
68
61
69
62
# "You can make an environment variable available to any subsequent steps in a workflow job by
70
63
# defining or updating the environment variable and writing this to the GITHUB_ENV environment file."
71
- - name : Set environment variables
64
+ - name : Setup custom version
65
+ if : ${{ github.event.inputs.custom_version != '' }}
72
66
run : |
73
- echo "VERSION="$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}" " >> $GITHUB_ENV
74
- echo "POSTFIX=${{ github.event.inputs.version-postfix }}" >> $GITHUB_ENV
75
- - name : Set production version
76
- if : ${{ github.event.inputs.version-postfix == 'no-postfix-prod' || github.event.inputs.version-postfix == 'alpha' || github.event.inputs.version-postfix == 'beta' }}
67
+ echo "VERSION=${{ github.event.inputs.custom_version }} " >> $GITHUB_ENV
68
+ - name : Setup version
69
+ if : ${{ github.event.inputs.custom_version == '' }}
70
+ shell : bash
77
71
run : |
78
- echo "VERSION="$(date +%Y).$(date +%-m)"" >> $GITHUB_ENV
79
- - name : Set version for minor release
80
- if : ${{ github.event.inputs.minor-release != 'none' }}
81
- run : |
82
- echo "VERSION=${{ env.VERSION }}.${{ github.event.inputs.minor-release }}" >> $GITHUB_ENV
83
- - name : Create version with postfix
84
- if : ${{ (env.POSTFIX == 'alpha') || (env.POSTFIX == 'beta') }}
85
- run :
86
- echo "VERSION=${{ env.VERSION }}-${{ env.POSTFIX }}" >> $GITHUB_ENV
72
+ echo "VERSION=${GITHUB_REF_NAME:0:4}-$(date +%Y).$(date +%-m).${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
73
+
87
74
- name : Print environment variables
88
75
run : printenv
89
76
0 commit comments