-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (63 loc) · 2.14 KB
/
Copy pathrelease-cli.yml
File metadata and controls
75 lines (63 loc) · 2.14 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
name: Release CLI
on:
push:
tags: ['cli/v*']
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., cli/v1.0.0). Leave empty when triggered by tag push.'
required: false
default: ''
permissions:
contents: write
jobs:
release:
name: Build & Release CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Resolve version
run: |
RAW_TAG="${{ github.event.inputs.version }}"
if [ -z "$RAW_TAG" ]; then
RAW_TAG="${{ github.ref_name }}"
fi
if [[ ! "$RAW_TAG" =~ ^cli/v ]]; then
echo "::error::Invalid tag format '$RAW_TAG'. Expected 'cli/v*' (e.g., cli/v0.1.0-beta.1)."
exit 1
fi
VERSION="${RAW_TAG#cli/}"
echo "TAG=$RAW_TAG" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
- uses: graalvm/setup-graalvm@54b4f5a65c1a84b2fdfdc2078fe43df32819e4b1 # v1
with:
java-version: '25'
distribution: 'graalvm'
- uses: gradle/actions/setup-gradle@48b5f213c81028ace310571dc5ec0fbbca0b2947 # v4.4.3
- name: Build and test all modules
run: ./gradlew build
- name: Build CLI uber-jar
run: ./gradlew hensu-cli:build -Dquarkus.package.type=uber-jar -x test
- name: Prepare release artifacts
run: |
CLI_JAR=$(find hensu-cli/build -maxdepth 1 -name '*-runner.jar' -type f)
cp "$CLI_JAR" "hensu-cli-${VERSION}-runner.jar"
cp hensu-cli/scripts/install.sh install.sh
cp hensu-cli/scripts/update.sh update.sh
cp hensu-cli/scripts/remove.sh remove.sh
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
PRERELEASE_FLAG=""
if [[ "$VERSION" =~ -(alpha|beta|rc) ]]; then
PRERELEASE_FLAG="--prerelease"
fi
gh release create "$TAG" \
--title "CLI $VERSION" \
--generate-notes \
$PRERELEASE_FLAG \
"hensu-cli-${VERSION}-runner.jar" \
install.sh \
update.sh \
remove.sh