@@ -3,45 +3,23 @@ name: "[M] Plugin and CLI: publish as archives"
33on :
44 workflow_call :
55 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
166 upload-artifact :
177 type : string
188 description : " Upload artifacts or not"
199 required : false
2010 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 : " "
2120
2221 workflow_dispatch :
2322 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
4523 upload-artifact :
4624 type : choice
4725 description : " Upload artifacts or not"
5028 options :
5129 - true
5230 - 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 : " "
5340
5441jobs :
5542 publish_plugin_and_cli :
@@ -65,25 +52,25 @@ jobs:
6552 container : unittestbot/java-env:java17-zulu-jdk-gradle7.6.1-kotlinc1.8.0
6653 steps :
6754 - 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 }}
6861
6962 # "You can make an environment variable available to any subsequent steps in a workflow job by
7063 # 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 != '' }}
7266 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
7771 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+
8774 - name : Print environment variables
8875 run : printenv
8976
0 commit comments