11# This workflow will build a Java project with Maven
22# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
33
4- name : Java CI with Maven
4+ name : CI/CD
55
66env :
7- install4j_download_url : https://download-gcdn.ej-technologies.com/install4j/install4j_linux-x64_9_0_2 .tar.gz
7+ install4j_download_url : https://download-gcdn.ej-technologies.com/install4j/install4j_linux-x64_9_0_4 .tar.gz
88
99on :
1010 push :
1414 install4j_download_url :
1515 description : Download source for Install4J
1616 required : true
17- default : https://download-gcdn.ej-technologies.com/install4j/install4j_linux-x64_9_0_2.tar.gz
17+ default : https://download-gcdn.ej-technologies.com/install4j/install4j_linux-x64_9_0_4.tar.gz
18+ release_build :
19+ description : Whether we should build the release files
20+ default : false
21+ create_draft :
22+ description : Whether a release draft should be generated - requires release_build
23+ default : false
24+ push_to_s3 :
25+ description : Whether generated products should be pushed to s3 - requires release_build
26+ default : false
1827
1928jobs :
2029 build :
2130 runs-on : ubuntu-latest
22- environment : install4j
2331 strategy :
2432 matrix :
2533 java : [ 16 ]
@@ -31,21 +39,23 @@ jobs:
3139 with :
3240 java-version : ${{ matrix.java }}
3341 distribution : ' adopt'
42+ # Install xvfb to provide a graphical environment to use when running tests
3443 - name : Set-up test environment
3544 run : |
3645 sudo apt-get update
3746 sudo apt-get install -y xvfb
3847 - name : Build with Maven
39- run : xvfb-run mvn -B -Djava.version=${{ matrix.java }} -Dopenjfx.version=${{ matrix.java }} test
48+ run : xvfb-run mvn -B -Djava.version=${{ matrix.java }} -Dopenjfx.version=${{ matrix.java }} -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 test
4049 - name : Save coverage stats
4150 uses : codecov/codecov-action@v1
4251 with :
4352 fail_ci_if_error : false
4453
45- package :
54+ release :
4655 runs-on : ubuntu-latest
56+ environment : install4j
4757 needs : build
48- if : ${{ startsWith(github.ref, 'refs/tags/') }}
58+ if : ${{ github.event.inputs.release_build || startsWith(github.ref, 'refs/tags/v ') }}
4959 strategy :
5060 matrix :
5161 java : [ 16 ]
@@ -59,12 +69,54 @@ jobs:
5969 distribution : ' adopt'
6070 - name : Download install4j
6171 run : |
62- wget --tries=3 ${{ github.event.inputs.install4j_download_url || env.install4j_download_url }} -O install4j.tar.gz
72+ wget --no-verbose -- tries=3 ${{ github.event.inputs.install4j_download_url || env.install4j_download_url }} -O install4j.tar.gz
6373 mkdir install4j
6474 tar -zxvf install4j.tar.gz --strip-components 1 -C install4j
6575 - name : Configure Install4J
6676 env :
6777 LICENSE_KEY_9 : ${{ secrets.INSTALL4J_LICENSE_KEY }}
6878 run : mvn install4j:install-license
69- - name : Package with maven and install4j
70- run : mvn -B -Dinstall4j.home=install4j -Djava.version=${{ matrix.java }} -Dopenjfx.version=${{ matrix.java }} package
79+ - name : Add signing key
80+ env :
81+ # The signing key secret file should be stored as a base64 string
82+ SIGNING_KEY : ${{ secrets.INSTALL4J_SIGNING_KEY }}
83+ run : ' echo "$SIGNING_KEY" | base64 -d >code_sign.p12'
84+ - name : Build with install4j
85+ env :
86+ LICENSE_KEY_9 : ${{ secrets.INSTALL4J_LICENSE_KEY }}
87+ MAC_KEYSTORE_PASSWORD : ${{ secrets.MAC_KEYSTORE_KEY }}
88+ run : mvn -B -DskipTests=true -Djava.version=${{ matrix.java }} -Dopenjfx.version=${{ matrix.java }} -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=600 package
89+ - name : Prepare release notes
90+ run : |
91+ awk -e '/^## /{a+=1} {if(a>1)exit} {if(a==1){print $0}}' CHANGELOG.md >RELEASE_MESSAGE.md
92+ printf '\n## Files checksums\n| File | SHA 256 |\n| --- | --- |\n' >>RELEASE_MESSAGE.md
93+ awk -e '{print"|"$2"|"$1"|"}' <target/media/sha256sums >>RELEASE_MESSAGE.md
94+ - name : Release draft
95+ uses : softprops/action-gh-release@v1
96+ if : ${{ github.event.inputs.create_draft || startsWith(github.ref, 'refs/tags/v') }}
97+ with :
98+ body_path : RELEASE_MESSAGE.md
99+ draft : true
100+ fail_on_unmatched_files : true
101+ files : |
102+ target/media/AsciidocFX_Mac.dmg
103+ target/media/AsciidocFX_Mac_No_JRE.dmg
104+ target/media/AsciidocFX_Linux.tar.gz
105+ target/media/AsciidocFX_Linux_No_JRE.tar.gz
106+ target/media/AsciidocFX_Windows.exe
107+ target/media/AsciidocFX_Windows_No_JRE.exe
108+ target/media/AsciidocFX_Windows.zip
109+ target/media/AsciidocFX_Windows_No_JRE.zip
110+ target/media/updates.xml
111+ LICENSE
112+ - name : Publish to S3
113+ uses :
jakejarvis/[email protected] 114+ if : ${{ github.event.inputs.push_to_s3 || startsWith(github.ref, 'refs/tags/v') }}
115+ with :
116+ args : --acl public-read --follow-symlinks --delete
117+ env :
118+ AWS_S3_BUCKET : ${{ secrets.AWS_S3_BUCKET }}
119+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
120+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
121+ AWS_REGION : ${{ secrets.AWS_REGION }}
122+ SOURCE_DIR : ' target/media'
0 commit comments