-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (135 loc) · 4.64 KB
/
Copy pathcli-native.yml
File metadata and controls
150 lines (135 loc) · 4.64 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: CLI Native Image builds
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build:
name: Build CLI on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
artifact: insight-macos-arm64
binary: insight
archive_ext: zip
- os: ubuntu-24.04
artifact: insight-linux-x64
binary: insight
archive_ext: zip
- os: windows-latest
artifact: insight-windows-x64
binary: insight.exe
archive_ext: zip
steps:
- uses: actions/checkout@v6
- uses: graalvm/setup-graalvm@v1
with:
java-version: '25'
distribution: 'graalvm'
cache: 'maven'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Show versions
shell: bash
run: |
java --version
# native-image isn't on PATH in bash on Windows; the maven native plugin
# invokes it via $GRAALVM_HOME directly, so this is purely diagnostic.
native-image --version || "$GRAALVM_HOME/bin/native-image" --version || true
- name: Determine version stamp
id: ver
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
else
VERSION="dev-${GITHUB_SHA::8}"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "stage_dir=${{ matrix.artifact }}-${VERSION}" >> "$GITHUB_OUTPUT"
echo "Building ${{ matrix.artifact }} version=${VERSION}"
- name: Build CLI native image
shell: bash
run: mvn -B -pl cli -am package -Pnative -DskipTests -Dgit.commit.id.abbrev="${GITHUB_SHA:0:8}"
- name: Stage release directory (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
STAGE="${{ steps.ver.outputs.stage_dir }}"
mkdir -p "$STAGE"
cp "cli/target/${{ matrix.binary }}" "$STAGE/"
chmod +x "$STAGE/${{ matrix.binary }}" || true
cp docs/install-cli.md "$STAGE/" 2>/dev/null || true
cp LICENSE "$STAGE/" 2>/dev/null || true
ls -la "$STAGE"
- name: Stage release directory (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$stage = "${{ steps.ver.outputs.stage_dir }}"
New-Item -ItemType Directory -Force -Path $stage | Out-Null
Copy-Item "cli/target/${{ matrix.binary }}" -Destination $stage
if (Test-Path "docs/install-cli.md") { Copy-Item "docs/install-cli.md" -Destination $stage }
if (Test-Path "LICENSE") { Copy-Item "LICENSE" -Destination $stage }
Get-ChildItem $stage
- name: Create archive (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
STAGE="${{ steps.ver.outputs.stage_dir }}"
ARCHIVE="${STAGE}.zip"
if command -v zip >/dev/null 2>&1; then
zip -r "$ARCHIVE" "$STAGE"
else
python3 -c "import shutil; shutil.make_archive('${STAGE}', 'zip', '.', '${STAGE}')"
fi
ls -la "$ARCHIVE"
- name: Create archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$stage = "${{ steps.ver.outputs.stage_dir }}"
Compress-Archive -Path "$stage/*" -DestinationPath "$stage.zip" -Force
Get-Item "$stage.zip"
- name: Upload archive artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: ${{ steps.ver.outputs.stage_dir }}.zip
if-no-files-found: error
release:
name: Publish GitHub Release
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Download all CLI artifacts
uses: actions/download-artifact@v8
with:
path: dist
- name: Flatten and checksum
shell: bash
run: |
mkdir -p release
find dist -type f -name '*.zip' -exec cp {} release/ \;
cd release
ls -la
sha256sum *.zip > SHA256SUMS
cat SHA256SUMS
- name: Create / update GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
release/*.zip
release/SHA256SUMS