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

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

see #17083 - sign jar files built on Github (forgot to export environment variable to Ant process)

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