8
8
branches :
9
9
- main
10
10
workflow_dispatch :
11
+ inputs :
12
+ JDTLS_VERSION :
13
+ description : " jdtls version"
14
+ required : false
15
+ FORCE_REPACKAGE :
16
+ description : " Replace package already exists"
17
+ required : true
18
+ default : false
19
+ type : boolean
11
20
12
21
permissions :
13
22
contents : write
14
23
15
24
jobs :
16
25
check-and-release :
26
+ env :
27
+ JDTLS_VERSION : ${{ github.event.inputs.JDTLS_VERSION }}
28
+ FORCE_REPACKAGE : ${{ github.event.inputs.FORCE_REPACKAGE }}
17
29
runs-on : ubuntu-latest
18
30
19
31
steps :
20
32
- name : Checkout repository
21
33
uses : actions/checkout@v3
22
34
23
- - name : Get latest jdtls version
24
- id : get_latest
35
+ - name : Set the latest jdtls version
36
+ if : env.JDTLS_VERSION == ''
25
37
run : |
26
38
pip install requests
27
- echo "latest_version =$(python ./get_latest.py)" >> $GITHUB_ENV
39
+ echo "JDTLS_VERSION =$(python ./get_latest.py)" >> $GITHUB_ENV
28
40
29
41
- name : Check if latest version has been released
42
+ if : env.FORCE_REPACKAGE == 'false'
30
43
env :
31
44
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
32
45
run : |
@@ -35,24 +48,28 @@ jobs:
35
48
-H "Accept: application/vnd.github.v3+json" \
36
49
https://api.github.com/repos/${{ github.repository }}/releases)
37
50
38
- if echo "$releases" | jq -e '.[] | select(.tag_name == "${{ env.latest_version }}")' > /dev/null; then
39
- echo "release_exists =true" >> $GITHUB_ENV
51
+ if echo "$releases" | jq -e '.[] | select(.tag_name == "${{ env.JDTLS_VERSION }}")' > /dev/null; then
52
+ echo "RELEASE_EXISTS =true" >> $GITHUB_ENV
40
53
else
41
- echo "release_exists =false" >> $GITHUB_ENV
54
+ echo "RELEASE_EXISTS =false" >> $GITHUB_ENV
42
55
fi
43
56
44
57
- name : Repackage jdtls
45
- if : env.release_exists == 'false'
58
+ if : env.RELEASE_EXISTS == 'false' || env.FORCE_REPACKAGE == 'true '
46
59
run : |
47
60
pip install requests
48
61
python ./repackage.py
49
62
ls
50
63
64
+ - name : Debug
65
+ run : |
66
+ env
67
+
51
68
- name : Release
52
- if : env.release_exists == 'false'
69
+ if : env.RELEASE_EXISTS == 'false' || env.FORCE_REPACKAGE == 'true '
53
70
uses : softprops/action-gh-release@v2
54
71
with :
55
72
files : jdtls.tar.gz
56
- make_latest : " true"
57
- name : " ${{env.latest_version }}"
58
- tag_name : " ${{env.latest_version }}"
73
+ make_latest : " ${{ github.event_name == 'scheduled' && ' true' || 'false' }} "
74
+ name : " ${{env.JDTLS_VERSION }}"
75
+ tag_name : " ${{env.JDTLS_VERSION }}"
0 commit comments