-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yml
54 lines (49 loc) · 1.6 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: "Execute Kotlin Script"
description: "Run the Kotlin Script with a compiler plugin"
author: Suresh
branding:
color: gray-dark
icon: package
inputs:
script:
description: 'Kotlin script to execute'
required: true
default: 'script.main.kts'
compiler-plugin:
description: 'Kotlin compiler plugin to use (kotlinx-serialization|allopen|noarg|lombok|sam-with-receiver|kotlin-imports-dumper)'
required: false
default: 'kotlinx-serialization'
cache:
description: 'Enable script dependencies caching'
required: false
default: 'true'
outputs:
plugin-path:
description: "Kotlin compiler plugin jar path"
value: ${{ steps.kotlin-plugin.outputs.plugin-path }}
kotlin-root:
description: "Kotlin installation directory"
value: ${{ steps.kotlin-plugin.outputs.kotlin-root }}
runs:
using: "composite"
steps:
- name: Get the Kotlin compiler plugin jar for ${{ inputs.compiler-plugin }}
id: kotlin-plugin
run: |
which kotlin
$GITHUB_ACTION_PATH/kotlin-plugin.sh ${{ inputs.compiler-plugin }}
shell: bash
- name: Cache dependencies
if: inputs.cache == 'true'
uses: actions/cache@v4
with:
path: |
~/.ivy2/cache
key: ${{ runner.os }}-ivy-${{ hashFiles('**/*.kts') }}
restore-keys: |
${{ runner.os }}-ivy-
- name: Run kotlin script ${{ inputs.script }}
run: |
# kotlinc -script -Xplugin=${{ steps.kotlin-plugin.outputs.plugin-path }} ${{ inputs.script }}
kotlin -Xplugin=${{ steps.kotlin-plugin.outputs.plugin-path }} ${{ inputs.script }}
shell: bash