generated from Kantis/kotlin-template
-
Notifications
You must be signed in to change notification settings - Fork 5
93 lines (74 loc) · 2.95 KB
/
gradle_task.yml
File metadata and controls
93 lines (74 loc) · 2.95 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Gradle Task
run-name: "Gradle Task ${{ inputs.gradle-task }} @ ${{ inputs.runs-on }}"
# Reusable Workflow for running a Gradle task
on:
workflow_dispatch:
workflow_call:
inputs:
ref:
description: "The git branch, tag or SHA to checkout"
required: false
type: string
gradle-task:
description: "The Gradle task to run, including any flags"
required: true
type: string
runs-on:
description: "OSes to run the task on"
required: true
type: string
concurrency:
# note: the Workflow inputs are also included in the concurrency group
group: "${{ github.workflow }} ${{ join(inputs.*) }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
permissions:
contents: read
jobs:
run-task:
runs-on: ${{ inputs.runs-on }}
name: "./gradlew ${{ inputs.gradle-task}} @ ${{ inputs.runs-on }}"
timeout-minutes: 60
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
ref: ${{inputs.ref }}
fetch-depth: 0
- name: Calculate version
id: version
uses: Kantis/semantic-version@master
with:
version_format: "${major}.${minor}.${patch}-SNAPSHOT"
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: gradle/actions/setup-gradle@v4
- id: cache-kotlin-konan
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-kotlin-konan
- id: stable-version
if: steps.version.outputs.is_tagged == 'true'
run: >
echo "version=${{ steps.version.outputs.major }}.${{steps.version.outputs.minor }}.${{steps.version.outputs.patch }}" >> $GITHUB_OUTPUT
- name: Run ${{ inputs.gradle-task }}
env:
ORG_GRADLE_PROJECT_ks3_enableKotlinJvm: true
ORG_GRADLE_PROJECT_ks3_enableKotlinJs: true
ORG_GRADLE_PROJECT_ks3_enableKotlinNative: true
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: >-
./gradlew ${{ inputs.gradle-task }} -Pversion="${{ steps.stable-version.outputs.version || steps.version.outputs.version }}"
- name: Upload build reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-report-${{ runner.os }}-${{ github.action }}
path: "**/build/reports/"
if-no-files-found: ignore