-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (52 loc) · 1.53 KB
/
release-github.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
name: Publish GitHub Release
on:
workflow_dispatch:
inputs:
ref:
description: 'Tag to run workflow on'
required: true
push:
tags:
- "v*.*.*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref || github.ref_name }}
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- name: Cache Gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build project
run: ./gradlew build
- name: Extract Changelog for Release
id: changelog
run: |
TAG_NAME="${GITHUB_REF##*/}"
VERSION="${TAG_NAME#v}"
sed -n "/## Version $VERSION/,/## Version/p" CHANGELOG.md | sed '1d;$d' | awk 'NF || p {print} {p = NF}' > release_notes.md
env:
GITHUB_REF: ${{ github.ref }}
- name: Create GitHub Release
id: create_release
uses: ncipollo/release-action@v1
with:
artifacts: "build/libs/*.jar"
bodyFile: "release_notes.md"
tag: ${{ github.ref_name }}
name: "Release ${{ github.ref_name }}"
draft: true