jdk
109 строк · 3.9 Кб
1#
2# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# This code is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 2 only, as
7# published by the Free Software Foundation. Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle in the LICENSE file that accompanied this code.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26name: 'Get BootJDK'27description: 'Download the BootJDK from cache or source location'28inputs:29platform:30description: 'Platform'31required: true32outputs:33path:34description: 'Path to the installed BootJDK'35value: ${{ steps.path-name.outputs.path }}36
37runs:38using: composite39steps:40- name: 'Determine platform prefix'41id: platform-prefix42run: |43# Convert platform name to upper case
44platform_prefix="$(echo ${{ inputs.platform }} | tr [a-z-] [A-Z_])"
45echo "value=$platform_prefix" >> $GITHUB_OUTPUT
46shell: bash47
48- name: 'Get URL configuration'49id: url50uses: ./.github/actions/config51with:52var: ${{ steps.platform-prefix.outputs.value}}_BOOT_JDK_URL53
54- name: 'Get SHA256 configuration'55id: sha25656uses: ./.github/actions/config57with:58var: ${{ steps.platform-prefix.outputs.value}}_BOOT_JDK_SHA25659
60- name: 'Get file extension configuration'61id: ext62uses: ./.github/actions/config63with:64var: ${{ steps.platform-prefix.outputs.value}}_BOOT_JDK_EXT65
66- name: 'Check cache for BootJDK'67id: get-cached-bootjdk68uses: actions/cache@v469with:70path: bootjdk/jdk71key: boot-jdk-${{ inputs.platform }}-${{ steps.sha256.outputs.value }}72
73# macOS is missing sha256sum74- name: 'Install sha256sum'75run: |76# Run Homebrew installation
77brew install coreutils
78shell: bash79if: steps.get-cached-bootjdk.outputs.cache-hit != 'true' && runner.os == 'macOS'80
81- name: 'Download BootJDK'82run: |83# Download BootJDK and verify checksum
84mkdir -p bootjdk/jdk
85mkdir -p bootjdk/unpacked
86wget --progress=dot:mega -O bootjdk/jdk.${{ steps.ext.outputs.value }} '${{ steps.url.outputs.value }}'
87echo '${{ steps.sha256.outputs.value }} bootjdk/jdk.${{ steps.ext.outputs.value }}' | sha256sum -c >/dev/null -
88shell: bash89if: steps.get-cached-bootjdk.outputs.cache-hit != 'true'90
91- name: 'Unpack BootJDK'92run: |93# Unpack the BootJDK and move files to a common location
94if [[ '${{ steps.ext.outputs.value }}' == 'tar.gz' ]]; then
95tar -xf bootjdk/jdk.${{ steps.ext.outputs.value }} -C bootjdk/unpacked
96else
97unzip -q bootjdk/jdk.${{ steps.ext.outputs.value }} -d bootjdk/unpacked
98fi
99jdk_root="$(dirname $(find bootjdk/unpacked -name bin -type d))"
100mv "$jdk_root"/* bootjdk/jdk/
101shell: bash102if: steps.get-cached-bootjdk.outputs.cache-hit != 'true'103
104- name: 'Export path to where BootJDK is installed'105id: path-name106run: |107# Export the absolute path
108echo "path=`pwd`/bootjdk/jdk" >> $GITHUB_OUTPUT
109shell: bash110