1 #
 2 # Copyright (c) 2022, 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 
26 name: 'Upload bundles'
27 description: 'Upload resulting JDK bundles'
28 inputs:
29   platform:
30     description: 'Platform name'
31     required: true
32   debug-suffix:
33     description: 'File name suffix denoting debug level, possibly empty'
34     required: false
35 
36 runs:
37   using: composite
38   steps:
39 
40     - name: 'Determine bundle names'
41       id: bundles
42       run: |
43         # Rename bundles to consistent names
44         jdk_bundle_zip="$(ls build/*/bundles/jdk-*_bin${{ inputs.debug-suffix }}.zip 2> /dev/null || true)"
45         jdk_bundle_tar_gz="$(ls build/*/bundles/jdk-*_bin${{ inputs.debug-suffix }}.tar.gz 2> /dev/null || true)"
46         symbols_bundle="$(ls build/*/bundles/jdk-*_bin${{ inputs.debug-suffix }}-symbols.tar.gz 2> /dev/null || true)"
47         tests_bundle="$(ls build/*/bundles/jdk-*_bin-tests${{ inputs.debug-suffix }}.tar.gz 2> /dev/null || true)"
48 
49         mkdir bundles
50 
51         if [[ "$jdk_bundle_zip" != "" ]]; then
52           mv "$jdk_bundle_zip" "bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip"
53         fi
54         if [[ "$jdk_bundle_tar_gz" != "" ]]; then
55           mv "$jdk_bundle_tar_gz" "bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz"
56         fi
57         if [[ "$symbols_bundle" != "" ]]; then
58           mv "$symbols_bundle" "bundles/symbols-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz"
59         fi
60         if [[ "$tests_bundle" != "" ]]; then
61           mv "$tests_bundle" "bundles/tests-${{ inputs.platform }}${{ inputs.debug-suffix }}.tar.gz"
62         fi
63 
64         if [[ "$jdk_bundle_zip$jdk_bundle_tar_gz$symbols_bundle$tests_bundle" != "" ]]; then
65           echo 'bundles-found=true' >> $GITHUB_OUTPUT
66         else
67           echo 'bundles-found=false' >> $GITHUB_OUTPUT
68         fi
69       shell: bash
70 
71     - name: 'Upload bundles artifact'
72       uses: actions/upload-artifact@v3
73       with:
74         name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }}
75         path: bundles
76         retention-days: 1
77       if: steps.bundles.outputs.bundles-found == 'true'