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

Last change on this file since 18151 was 18151, checked in by Don-vip, 3 years ago

see #17083 - another attempt to locate signtool, don't know exactly where it is

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