-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (86 loc) · 3.06 KB
/
build_save-cli_reusable.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
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
name: Reusable build save-cli
on:
workflow_call:
outputs:
version:
description: "Version of save-cli taken from gradle/libs.versions.toml"
value: ${{ jobs.retrieve_save_cli_version.outputs.version }}
jobs:
retrieve_save_cli_version:
name: Retrieve save-cli version from save-cloud
runs-on: ubuntu-latest
outputs:
version: ${{ steps.save-cli-version.outputs.version }}
steps:
- name: checkout save-cloud
uses: actions/checkout@v4
with:
sparse-checkout: |
gradle/libs.versions.toml
sparse-checkout-cone-mode: false
- id: save-cli-version
name: Store save-cli version in output
run: |
sv=$(cat gradle/libs.versions.toml | grep -m1 '^save-cli =' | awk -F'[=]' '{print $2}' | tr -d '" ')
echo "Detected version $sv"
echo version=$sv >> $GITHUB_OUTPUT
build_save-cli:
name: Build save-cli
needs: retrieve_save_cli_version
if: ${{ endsWith(needs.retrieve_save_cli_version.outputs.version, 'SNAPSHOT') }}
runs-on: ubuntu-latest
steps:
- name: checkout save-cli
uses: actions/checkout@v4
with:
repository: saveourtool/save-cli
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Retrieve Kotlin version
shell: bash
run: |
kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ')
echo SAVE_CLI_KOTLIN_VERSION=$kv >> $GITHUB_ENV
- name: Cache konan
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-konan-${{ env.SAVE_CLI_KOTLIN_VERSION }}
- name: Build save-cli
uses: gradle/gradle-build-action@v3
with:
gradle-version: wrapper
arguments: |
:save-cli:linkReleaseExecutableLinuxX64
--build-cache
-PgprUser=${{ github.actor }}
-PgprKey=${{ secrets.GITHUB_TOKEN }}
-Preckon.stage=snapshot
- name: Set save-cli version from built artifact
run: |
find save-cli/build/bin/linuxX64/releaseExecutable -name "save-*.kexe" -exec sh -c 'printf "$1" | sed -r "s/.*save-(.*)-linuxX64.kexe/\1/" | echo "SAVE_CLI_VERSION=$(cat)" >> $GITHUB_ENV' _ {} \;
- name: Upload save-cli
uses: actions/upload-artifact@v4
with:
name: save-cli
path: 'save-cli/build/bin/linuxX64/releaseExecutable/save-*.kexe'
retention-days: 1
- name: Upload gradle reports
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: gradle-reports
path: '**/build/reports/'
retention-days: 1
build_save-cli_skipped:
needs: retrieve_save_cli_version
if: ${{ !endsWith(needs.retrieve_save_cli_version.outputs.version, 'SNAPSHOT') }}
runs-on: ubuntu-latest
steps:
- name: Do nothing
run: |
echo "Build of save-cli is skipped"