diff --git a/action.yml b/action.yml index 174ec56..0e20a6e 100644 --- a/action.yml +++ b/action.yml @@ -45,11 +45,24 @@ inputs: required: false description: 'Post a comment containing a Native Image build report on pull requests.' default: 'false' + mvn-settings-path: + description: 'Path to where the settings.xml file will be written. Default is ~/.m2.' + required: false outputs: cache-hit: description: 'A boolean value to indicate an exact match was found for the primary key' runs: - using: 'node16' - main: 'dist/main/index.js' - post: 'dist/cleanup/index.js' - post-if: 'success()' + using: "composite" + steps: + - uses: ./dist + id: graalvm + - name: 'Install Java Development Kit' + uses: actions/setup-java@v3 + with: + java-version: ${{ inputs.java-version }} + distribution: jdkfile + jdkFile: ${{ steps.graalvm.outputs.archive }} + cache: ${{ inputs.cache }} + settings-path: ${{ inputs.mvn-settings-path }} + - shell: bash + run: echo "GRAALVM_HOME=$JAVA_HOME" >> $GITHUB_ENV diff --git a/dist/action.yml b/dist/action.yml new file mode 100644 index 0000000..afcc8f6 --- /dev/null +++ b/dist/action.yml @@ -0,0 +1,55 @@ +name: 'GitHub Action for GraalVM' +description: 'Set up a specific version of GraalVM Community Edition (CE) or Enterprise Edition (EE)' +author: 'GraalVM Community' +branding: + icon: 'terminal' + color: 'blue' +inputs: + version: + required: true + description: 'GraalVM version (release, latest, dev).' + gds-token: + required: false + description: 'Download token for the GraalVM Download Service. If provided, the action will set up GraalVM Enterprise Edition.' + java-version: + required: true + description: 'Java version (11 or 17, 8 or 16 for older releases).' + components: + required: false + description: 'Comma-separated list of GraalVM components to be installed.' + default: '' + github-token: + required: false + description: 'Set it to secrets.GITHUB_TOKEN to increase rate limits when accessing the GitHub API.' + default: '' + set-java-home: + required: false + description: 'Set $JAVA_HOME to the GraalVM installation. Default: true.' + default: 'true' + cache: + description: 'Name of the build platform to cache dependencies. It can be "maven", "gradle", or "sbt".' + required: false + check-for-updates: + required: false + description: 'Annotate jobs with update notifications, for example, when a new GraalVM release is available' + default: 'true' + native-image-musl: + required: false + description: 'Set up musl for static image building with GraalVM Native Image.' + default: 'false' + native-image-job-reports: + required: false + description: 'Post a job summary containing a Native Image build report.' + default: 'false' + native-image-pr-reports: + required: false + description: 'Post a comment containing a Native Image build report on pull requests.' + default: 'false' +outputs: + cache-hit: + description: 'A boolean value to indicate an exact match was found for the primary key' +runs: + using: 'node16' + main: 'main/index.js' + post: 'cleanup/index.js' + post-if: 'success()' diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index e122576..feb4c48 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -74448,7 +74448,9 @@ function getLatestRelease(repo) { exports.getLatestRelease = getLatestRelease; function downloadAndExtractJDK(downloadUrl) { return __awaiter(this, void 0, void 0, function* () { - return findJavaHomeInSubfolder(yield extract(yield tc.downloadTool(downloadUrl))); + const archive = yield tc.downloadTool(downloadUrl); + core.setOutput('archive', archive); + return findJavaHomeInSubfolder(yield extract(archive)); }); } exports.downloadAndExtractJDK = downloadAndExtractJDK; diff --git a/dist/main/index.js b/dist/main/index.js index b661fa3..5fac28a 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -75195,7 +75195,9 @@ function getLatestRelease(repo) { exports.getLatestRelease = getLatestRelease; function downloadAndExtractJDK(downloadUrl) { return __awaiter(this, void 0, void 0, function* () { - return findJavaHomeInSubfolder(yield extract(yield tc.downloadTool(downloadUrl))); + const archive = yield tc.downloadTool(downloadUrl); + core.setOutput('archive', archive); + return findJavaHomeInSubfolder(yield extract(archive)); }); } exports.downloadAndExtractJDK = downloadAndExtractJDK; diff --git a/src/utils.ts b/src/utils.ts index 5ec71ac..653a0b3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -50,9 +50,9 @@ export async function getLatestRelease( export async function downloadAndExtractJDK( downloadUrl: string ): Promise { - return findJavaHomeInSubfolder( - await extract(await tc.downloadTool(downloadUrl)) - ) + const archive = await tc.downloadTool(downloadUrl) + core.setOutput('archive', archive) + return findJavaHomeInSubfolder(await extract(archive)) } export async function downloadExtractAndCacheJDK(