Skip to content

Commit 5dcd3a8

Browse files
committed
Add release support in github workflow
1 parent 1014828 commit 5dcd3a8

File tree

3 files changed

+78
-13
lines changed

3 files changed

+78
-13
lines changed

.github/workflows/maven.yml

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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

66
env:
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

99
on:
1010
push:
@@ -14,12 +14,20 @@ on:
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

1928
jobs:
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'

asciidocfx.install4j

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<install4j version="9.0.1" transformSequenceNumber="9">
2+
<install4j version="9.0.4" transformSequenceNumber="9">
33
<directoryPresets config="/Users/usta/projects/AsciidocFX/jmods" />
44
<application name="AsciidocFX" applicationId="7853-9376-5862-1224" mediaDir="target" compression="4" lzmaCompression="true" excludeSignedFromPacking="false" shortName="AsciidocFX" publisher="AsciidocFX" publisherWeb="http://asciidocfx.com" version="1.7.4" macVolumeId="b98c377570068f5e" javaMinVersion="16" javaMaxVersion="16" allowBetaVM="true">
55
<searchSequence>
66
<envVar name="JAVA_HOME" />
77
<envVar name="JDK_HOME" />
88
<registry />
99
</searchSequence>
10-
<codeSigning macEnabled="true" macPkcs12File="/home/travis/build/asciidocfx/AsciidocFX/code_sign.p12" />
10+
<codeSigning macEnabled="true" macPkcs12File="code_sign.p12" />
1111
<jreBundles jdkProviderId="AdoptOpenJDK-OpenJ9" release="16/jdk-16.0.1+9_openj9-0.26.0">
1212
<modules>
1313
<defaultModules set="jre" />
@@ -1192,6 +1192,18 @@ return true;</property>
11921192
</modules>
11931193
</jreBundle>
11941194
</unixArchive>
1195+
<windows name="Windows Installer No JRE" id="407" mediaFileName="AsciidocFX_Windows_No_JRE">
1196+
<jreBundle usePack200="false" jreBundleSource="none" />
1197+
</windows>
1198+
<windowsArchive name="Windows Archive No JRE" id="416" mediaFileName="AsciidocFX_Windows_No_JRE">
1199+
<jreBundle jreBundleSource="none" />
1200+
</windowsArchive>
1201+
<macosFolder name="Mac OS X Folder No JRE" id="4500" mediaFileName="AsciidocFX_Mac_No_JRE" signLaunchers="true">
1202+
<jreBundle release="16/jdk-16+36" usePack200="false" jreBundleSource="none" />
1203+
</macosFolder>
1204+
<unixArchive name="Unix Archive No JRE" id="413" mediaFileName="AsciidocFX_Linux_No_JRE">
1205+
<jreBundle jreBundleSource="none" />
1206+
</unixArchive>
11951207
</mediaSets>
11961208
<buildIds>
11971209
<mediaSet refId="1110" />

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
<maven.compiler.source>${java.version}</maven.compiler.source>
1717
<maven.compiler.target>${java.version}</maven.compiler.target>
1818
<mainClass>com.kodedu.boot.AppStarter</mainClass>
19-
<install4j.home>/home/travis/build/asciidocfx/AsciidocFX/install4j9.0.2</install4j.home>
19+
<install4j.home>install4j</install4j.home>
2020
<install4j.licenseKey>${env.LICENSE_KEY_9}</install4j.licenseKey>
21+
<install4j.macKeystorePassword>${env.MAC_KEYSTORE_PASSWORD}</install4j.macKeystorePassword>
2122
<openjfx.version>16</openjfx.version>
2223
<ikonli.version>12.2.0</ikonli.version>
2324
<jaxb.version>2.3.2</jaxb.version>

0 commit comments

Comments
 (0)