-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (94 loc) · 3.16 KB
/
Copy pathrelease.yml
File metadata and controls
105 lines (94 loc) · 3.16 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
name: Release
on:
workflow_dispatch:
inputs:
update_type:
description: Update type
required: true
default: patch
type: choice
options:
- patch
- minor
make_latest:
description: Mark release as latest
required: false
default: true
type: boolean
permissions:
contents: write
jobs:
build-and-release:
if: github.ref == 'refs/heads/master' && github.repository == 'slyphmp4/CloverChat'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Java
uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c
with:
distribution: temurin
java-version: "25"
cache: gradle
- name: Grant Execute Permission
run: chmod +x gradlew
- name: Bump Version
id: bump
shell: bash
run: |
set -euo pipefail
if [ "${{ inputs.update_type }}" = "minor" ]; then
./gradlew bumpMinorVersion --no-daemon --dependency-verification=strict
else
./gradlew bumpPatchVersion --no-daemon --dependency-verification=strict
fi
VERSION=$(grep '^pluginVersion=' gradle.properties | cut -d'=' -f2)
echo "value=$VERSION" >> "$GITHUB_OUTPUT"
- name: Commit Version
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
git config user.name "slyphmp4"
git config user.email "slyphmp4@users.noreply.github.com"
git add gradle.properties
git commit -m "chore: bump plugin version to ${{ steps.bump.outputs.value }}"
AUTH=$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 -w0)
git -c http.extraheader="AUTHORIZATION: basic $AUTH" push origin HEAD:master
- name: Build
run: ./gradlew build --no-daemon --dependency-verification=strict
- name: Prepare Release Files
shell: bash
run: |
set -euo pipefail
(
cd build/libs
sha256sum CloverChat.jar > CloverChat.jar.sha256
)
./gradlew dependencies --configuration runtimeClasspath --no-daemon --dependency-verification=strict \
> build/libs/CloverChat-dependencies.txt
- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: v${{ steps.bump.outputs.value }}
MAKE_LATEST: ${{ inputs.make_latest }}
shell: bash
run: |
set -euo pipefail
LATEST_FLAG="--latest=false"
if [ "$MAKE_LATEST" = "true" ]; then
LATEST_FLAG="--latest"
fi
gh release create "$RELEASE_TAG" \
build/libs/CloverChat.jar \
build/libs/CloverChat.jar.sha256 \
build/libs/CloverChat-dependencies.txt \
--repo "$GITHUB_REPOSITORY" \
--target "$(git rev-parse HEAD)" \
--title "$RELEASE_TAG" \
--generate-notes \
"$LATEST_FLAG"