-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (97 loc) · 3.08 KB
/
Copy pathgithub_release.yml
File metadata and controls
108 lines (97 loc) · 3.08 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
name: github_release
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag Name'
required: true
default: 'tag'
type: string
release_name:
description: 'Release Name'
required: true
default: 'release'
type: string
description:
description: 'Description'
required: true
default: 'No description provided'
type: string
draft:
description: 'Draft'
required: true
default: false
type: boolean
pre_release:
description: 'Pre-Release'
required: true
default: false
type: boolean
latest:
description: 'Latest'
required: true
default: true
type: boolean
jobs:
release:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: setup jdk 25
uses: actions/setup-java@v4
with:
java-version: 25
distribution: 'microsoft'
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
env:
GRADLE_FULL_RANGE: "true"
- name: Commit message newline
run: |
DESCRIPTION_RAW="${{ github.event.inputs.description }}"
DESCRIPTION_NEWLINE=$(echo "$DESCRIPTION_RAW" | sed 's/\\n/\'$'\n''/g')
echo "DESCRIPTION_NEWLINE<<EOF" >> $GITHUB_ENV
echo "$DESCRIPTION_NEWLINE" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
#- name: capture build artifacts
# uses: actions/upload-artifact@v4
# with:
# name: Built JARs
# path: |
# ./versions/**/build/libs/*.jar
- name: Filter non-source JAR files
id: filtered_jars
run: |
jars=$(find ./versions/**/build/libs/ -type f -name "*.jar" ! -name "*-sources.jar")
echo "jar_files<<EOF" >> $GITHUB_OUTPUT
echo "$jars" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Generate Version Tag
id: version
run: |
# Generate a version based on current date and commit hash
VERSION="$(echo ${{ github.event.inputs.tag_name }})"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Generated version: $VERSION"
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Create GitHub Release with JARs
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.version.outputs.version }}
name: ${{ github.event.inputs.release_name }}
body: |
${{ env.DESCRIPTION_NEWLINE }}
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.pre_release }}
make_latest: ${{ inputs.latest }}
files: |
${{ steps.filtered_jars.outputs.jar_files }}