-
Notifications
You must be signed in to change notification settings - Fork 121
82 lines (67 loc) · 2.46 KB
/
build-bootJar-on-comment.yaml
File metadata and controls
82 lines (67 loc) · 2.46 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
name: Build bootJar on PR comment
on:
issue_comment:
types: [created]
permissions:
contents: read
issues: write # писать комментарии в PR (issues API)
actions: read
jobs:
build-jar:
# Только если комментарий к PR и в нём есть /buildJar
if: >
github.event.issue.pull_request != '' &&
contains(github.event.comment.body, '/buildJar')
runs-on: ubuntu-latest
steps:
- name: Checkout repository with full history
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up JDK 17 (Corretto) with Gradle cache
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
cache: 'gradle'
- name: Make Gradle wrapper executable (if needed)
run: chmod +x ./gradlew
- name: Build bootJar
run: ./gradlew bootJar
- name: List built JARs
id: list_jars
run: |
if ! ls build/libs/*.jar >/dev/null 2>&1; then
echo "No JAR found in build/libs"
exit 1
fi
echo "Найдены JAR-файлы:"
ls -1 build/libs/*.jar
# Собираем список файлов в формате markdown-списка
{
for path in build/libs/*.jar; do
echo "- \`$(basename "$path")\`"
done
} > jar_list.txt
echo 'list<<EOF' >> "$GITHUB_OUTPUT"
cat jar_list.txt >> "$GITHUB_OUTPUT"
echo 'EOF' >> "$GITHUB_OUTPUT"
- name: Upload JAR artifact
id: upload_jar
uses: actions/upload-artifact@v4
with:
# имя артефакта; можешь поменять на что-то своё
name: bootJar-${{ github.run_id }}
path: build/libs/*.jar
# retention-days: 7 # при желании
- name: Comment on PR with JAR link
uses: peter-evans/create-or-update-comment@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
✅ Собраны JAR-файлы для этого PR по команде `/buildJar`.
**Артефакт:** [${{ steps.upload_jar.outputs.artifact-name }}](${{ steps.upload_jar.outputs.artifact-url }})
**Файлы внутри:**
${{ steps.list_jars.outputs.list }}