Fix Windows run and merge tag+jar into version input

This commit is contained in:
Christian Stein 2021-03-27 20:23:46 +01:00
parent f25fbbb80e
commit ea8307908b
2 changed files with 32 additions and 14 deletions

View file

@ -8,32 +8,31 @@ branding:
inputs:
tag:
description: 'The GitHub releases tag that points to JReleaser''s executable JAR file.'
version:
description: 'The version of JReleaser to download and execute.'
default: 'early-access'
required: true
jar:
description: 'The name of the executable JAR file to download and execute.'
default: 'jreleaser-tool-provider-0.1.0-SNAPSHOT.jar'
required: true
arguments:
description: 'The arguments to be passed to JReleaser.'
description: 'The command-line arguments to be passed to JReleaser.'
default: 'full-release'
required: true
runs:
using: 'composite'
steps:
- name: 'Initialize JReleaser'
- name: 'Download JReleaser'
shell: bash
run: |
echo "Initialize JReleaser"
wget https://github.com/jreleaser/jreleaser/releases/download/${{ inputs.tag }}/${{ inputs.jar }}
echo "::group::Download JReleaser"
JAR="jreleaser-tool-provider-${{ inputs.version }}.jar"
URL="https://github.com/jreleaser/jreleaser/releases/download/${{ inputs.version }}/$JAR"
java ${{ github.action_path }}/copy.java $URL $JAR
java -jar $JAR --version
echo "::endgroup::"
- name: 'Launch JReleaser'
- name: 'Execute JReleaser'
shell: bash
run: |
echo "java -jar ${{ inputs.jar }} ${{ inputs.arguments }}"
java -jar ${{ inputs.jar }} ${{ inputs.arguments }}
JAR="jreleaser-tool-provider-${{ inputs.version }}.jar"
echo "java -jar $JAR ${{ inputs.arguments }}"
java -jar $JAR ${{ inputs.arguments }}

19
copy.java Normal file
View file

@ -0,0 +1,19 @@
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
class copy {
public static void main(String... args) throws Exception {
if (args.length != 2) {
System.err.println("Usage: java copy.java URL FILENAME");
System.exit(1);
}
var url = args[0];
try (var stream = new URL(url).openStream()) {
var file = Path.of(args[1]);
var size = Files.copy(stream, file, StandardCopyOption.REPLACE_EXISTING);
System.out.printf("%s << copied %d bytes << %s%n", file, size, url);
}
}
}