source: josm/trunk/.github/workflows/ant.yml@ 18936

Last change on this file since 18936 was 18906, checked in by stoecker, 12 months ago

add missing APPLE_ID, see #23335

File size: 9.0 KB
Line 
1name: Java CI Build
2env:
3 junit_platform_version: '1.9.3'
4 JAVAFX_VERSION: '17.0.7'
5on:
6 push:
7 branches: [master]
8
9defaults:
10 run:
11 shell: bash
12
13jobs:
14
15 createrelease:
16 name: Create Release
17 runs-on: ubuntu-latest
18 env:
19 LANG: en_US.UTF-8
20 outputs:
21 upload_url: ${{ steps.create_release.outputs.upload_url }}
22 josm_revision: ${{ steps.create_revision.outputs.josm_revision }}
23 josm_prerelease: ${{ steps.create_revision.outputs.josm_prerelease }}
24 josm_release_tag: ${{ steps.create_revision.outputs.josm_release_tag }}
25 steps:
26 - name: Checkout
27 uses: actions/checkout@v3
28 with:
29 fetch-depth: 256
30
31 - name: Set revision env variable
32 id: create_revision
33 # grab josm revision from last git-svn-id
34 run: |
35 josm_revision="$(git log -1 --grep 'git-svn-id: https://josm.openstreetmap.de/svn/trunk@' --pretty=format:%B | tail -1 | sed -n 's%git-svn-id: https://josm.openstreetmap.de/svn/trunk@\([0-9]*\) [-0-9a-f]*%\1%p')"
36 if [[ "$josm_revision" == "$(curl --silent https://josm.openstreetmap.de/tested)" ]]; then
37 echo "josm_prerelease=false" >> $GITHUB_ENV
38 echo "josm_prerelease=false" >> $GITHUB_OUTPUT
39 josm_release_tag=$josm_revision-tested
40 else
41 echo "josm_prerelease=true" >> $GITHUB_ENV
42 echo "josm_prerelease=true" >> $GITHUB_OUTPUT
43 josm_release_tag=$josm_revision
44 fi
45 echo "josm_revision=$josm_revision" >> $GITHUB_ENV
46 echo "josm_revision=$josm_revision" >> $GITHUB_OUTPUT
47 echo "josm_release_tag=$josm_release_tag" >> $GITHUB_ENV
48 echo "josm_release_tag=$josm_release_tag" >> $GITHUB_OUTPUT
49
50 - name: Create release
51 id: create_release
52 uses: actions/create-release@v1
53 env:
54 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
55 with:
56 tag_name: ${{ env.josm_release_tag }}
57 release_name: JOSM release ${{ env.josm_release_tag }}
58 body: |
59 JOSM release ${{ env.josm_release_tag }}
60 draft: false
61 prerelease: ${{ env.josm_prerelease }}
62
63 build:
64 needs: createrelease
65 runs-on: ${{ matrix.os }}
66 env:
67 LANG: en_US.UTF-8
68 strategy:
69 fail-fast: false
70 matrix:
71 # test against latest update of each major Java version, as well as specific updates of LTS versions:
72 java: [8, 11, 17, 21, 22-ea]
73 os: [ubuntu-latest, macos-latest, windows-latest]
74 name: Java ${{ matrix.java }} on ${{ matrix.os }}
75 steps:
76 - name: Checkout
77 uses: actions/checkout@v3
78 with:
79 fetch-depth: 256
80
81 - name: Cache
82 uses: actions/cache@v3
83 with:
84 path: |
85 ~/.ivy2/cache/
86 ~/work/josm/josm/tools/
87 key: ${{ runner.os }}-ivy2-${{ hashFiles('build.xml', 'ivy.xml', 'tools/ivy.xml') }}
88
89 - name: Setup Java ${{ matrix.java }}
90 uses: actions/setup-java@v3
91 with:
92 distribution: 'zulu'
93 java-version: ${{ matrix.java }}
94
95 - name: Install Ant
96 uses: JOSM/JOSMPluginAction/actions/setup-ant@v1
97
98 - name: Optimise images
99 if: ${{ runner.os == 'macos' && always() }}
100 run: |
101 brew install --cask imageoptim
102 defaults write net.pornel.ImageOptim SvgoEnabled 1
103 defaults write net.pornel.ImageOptim PngCrush2Enabled 1
104 defaults write net.pornel.ImageOptim PngOutEnabled 1
105 /Applications/ImageOptim.app/Contents/MacOS/ImageOptim resources/images
106
107 - name: Build with Ant
108 env:
109 SIGN_ALIAS: ${{ secrets.SIGN_ALIAS }}
110 SIGN_CERT: ${{ secrets.SIGN_CERT }}
111 SIGN_KEYPASS: ${{ secrets.SIGN_KEYPASS }}
112 SIGN_STOREPASS: ${{ secrets.SIGN_STOREPASS }}
113 SIGN_TSA: ${{ secrets.SIGN_TSA }}
114 # Calls ant with -Dreleasebuild=true if we're a 'tested' build
115 run: |
116 export SIGN_KEYSTORE=certificate.p12
117 echo "$SIGN_CERT" | base64 --decode > $SIGN_KEYSTORE
118 if [ "${{ needs.createrelease.outputs.josm_prerelease }}" == "true" ]; then
119 ANT="ant"
120 else
121 ANT="ant -Dreleasebuild=true"
122 fi
123 $ANT dist
124 rm $SIGN_KEYSTORE
125
126 - name: Upload jar
127 if: ${{ always() }}
128 env:
129 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130 uses: actions/upload-release-asset@v1
131 with:
132 upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
133 asset_path: dist/josm-custom.jar
134 asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.jar
135 asset_content_type: application/java-archive
136
137 - name: Build and package for macOS
138 if: ${{ runner.os == 'macos' && matrix.java != '8' && matrix.java != '11' && always() }}
139 env:
140 CERT_MACOS_P12: ${{ secrets.CERT_MACOS_P12 }}
141 CERT_MACOS_PW: ${{ secrets.CERT_MACOS_PW }}
142 APPLE_ID: ${{ secrets.APPLE_ID }}
143 APPLE_ID_PW: ${{ secrets.APPLE_ID_PW }}
144 APPLE_ID_TEAM: ${{ secrets.APPLE_ID_TEAM }}
145 run: |
146 if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then
147 curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_osx-x64_bin-jmods.zip
148 fi
149 unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip
150 mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/
151 ./native/macosx/macos-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }}
152
153 - name: Setup Windows PATH
154 if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() }}
155 run: |
156 echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH
157 echo "C:\Program Files (x86)\Windows Kits\10\bin\x64" >> $GITHUB_PATH
158 echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
159
160 - name: Build and package for Windows
161 if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() }}
162 env:
163 SIGN_CERT: ${{ secrets.SIGN_CERT }}
164 SIGN_STOREPASS: ${{ secrets.SIGN_STOREPASS }}
165 SIGN_TSA: ${{ secrets.SIGN_TSA }}
166 run: |
167 if [ ! -f tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip ]; then
168 curl -o tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip https://download2.gluonhq.com/openjfx/${JAVAFX_VERSION}/openjfx-${JAVAFX_VERSION}_windows-x64_bin-jmods.zip
169 fi
170 unzip tools/openjfx-${JAVAFX_VERSION}_${{ runner.os }}-jmods.zip
171 mv javafx-jmods-${JAVAFX_VERSION}/*.jmod $JAVA_HOME/jmods/
172 ./native/windows/win-jpackage.sh ${{ needs.createrelease.outputs.josm_revision }}
173
174 - name: Upload macOS app
175 if: ${{ runner.os == 'macos' && matrix.java != '8' && matrix.java != '11' && always() }}
176 uses: actions/upload-release-asset@v1
177 env:
178 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
179 with:
180 upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
181 asset_path: app/JOSM.zip
182 asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.zip
183 asset_content_type: application/zip
184
185 - name: Upload Windows Installer executable
186 if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() }}
187 uses: actions/upload-release-asset@v1
188 env:
189 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
190 with:
191 upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
192 asset_path: app/JOSM.exe
193 asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.exe
194 asset_content_type: application/vnd.microsoft.portable-executable
195
196 - name: Upload Windows Installer package
197 if: ${{ runner.os == 'windows' && matrix.java != '8' && matrix.java != '11' && always() }}
198 uses: actions/upload-release-asset@v1
199 env:
200 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201 with:
202 upload_url: ${{ needs.createrelease.outputs.upload_url }} # This pulls from the CREATE RELEASE job above, referencing its ID to get its outputs object, which include a `upload_url`.
203 asset_path: app/JOSM.msi
204 asset_name: JOSM-${{ runner.os}}-java${{ matrix.java }}-${{ needs.createrelease.outputs.josm_revision }}.msi
205 asset_content_type: application/x-ole-storage
Note: See TracBrowser for help on using the repository browser.