Skip to content

Commit 9200616

Browse files
committed
Add custom action to install Java via Jabba
1 parent c03f382 commit 9200616

12 files changed

+3776
-5363
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__tests__/runner/*
22

33
# comment out in distribution branches
4-
node_modules/
4+
/node_modules/
55

66
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
77
# Logs

__tests__/main.test.ts

+3-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
1-
import {wait} from '../src/wait'
2-
import * as process from 'process'
3-
import * as cp from 'child_process'
4-
import * as path from 'path'
1+
import { install } from "../src/install";
52

6-
test('throws invalid number', async() => {
7-
await expect(wait('foo')).rejects.toThrow('milleseconds not a number');
3+
test("install", async () => {
4+
await install(8);
85
});
9-
10-
test('wait 500 ms', async() => {
11-
const start = new Date();
12-
await wait(500);
13-
const end = new Date();
14-
var delta = Math.abs(end.getTime() - start.getTime());
15-
expect(delta).toBeGreaterThan(450);
16-
});
17-
18-
// shows how the runner will run a javascript action with env / stdout protocol
19-
test('test runs', () => {
20-
process.env['INPUT_MILLISECONDS'] = '500';
21-
const ip = path.join(__dirname, '..', 'lib', 'main.js');
22-
console.log(cp.execSync(`node ${ip}`).toString());
23-
})

action.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
name: 'Your name here'
2-
description: 'Provide a description here'
3-
author: 'Your name or organization here'
1+
name: "setup-java"
2+
description: "Installs AdoptOpenJDK via Jabba"
3+
author: "Olafur Pall Geirsson"
44
inputs:
5-
myInput: # change this
6-
description: 'input description here'
7-
default: 'default value if applicable'
5+
java-version:
6+
description: >
7+
The Java version to install, a string matching the output format
8+
from `jabba ls-remote`. For example, "[email protected]" for the latest
9+
AdoptOpenJDK 8 version, "[email protected]" for the latest AdoptOpenJDK 11
10+
version, or "graalvm@" for the latest GraalVM version.
11+
default: "[email protected]"
812
runs:
9-
using: 'node12'
10-
main: 'lib/main.js'
13+
using: "node12"
14+
main: "lib/main.js"

bin/release.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
set -eux
3+
git add .
4+
git diff --exit-code
5+
current_branch=$(git rev-parse --abbrev-ref HEAD)
6+
test 'master' = $current_branch
7+
git checkout master-node_modules
8+
git reset --hard master
9+
rm -rf node_modules
10+
yarn install
11+
yarn run build
12+
yarn install --prod
13+
sed -i '' '/node_modules/d' .gitignore
14+
git add .
15+
git commit -m "Generate artifacts"
16+
git push -f origin master-node_modules
17+
git co master
18+
rm -rf node_modules
19+
yarn install

lib/main.js

-35
This file was deleted.

lib/wait.js

-11
This file was deleted.

0 commit comments

Comments
 (0)