-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (78 loc) · 2.63 KB
/
Copy pathpre-release.yml
File metadata and controls
89 lines (78 loc) · 2.63 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
name: Pre-Release
on:
workflow_run:
workflows:
- CI
types:
- completed
branches:
- master
permissions:
contents: write
jobs:
publish-pre-release:
if: >-
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.head_repository.full_name == github.repository &&
github.event.workflow_run.head_branch == 'master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
persist-credentials: false
- name: Verify Trusted Revision
shell: bash
run: |
set -euo pipefail
EXPECTED_SHA="${{ github.event.workflow_run.head_sha }}"
test "$(git rev-parse HEAD)" = "$EXPECTED_SHA"
git fetch --no-tags origin master
git merge-base --is-ancestor "$EXPECTED_SHA" origin/master
- 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: 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: Prepare Tag
id: tag
shell: bash
run: |
set -euo pipefail
SHORT_SHA=$(echo "${{ github.event.workflow_run.head_sha }}" | cut -c1-7)
echo "value=pre-${{ github.run_number }}-$SHORT_SHA" >> "$GITHUB_OUTPUT"
- name: Publish Pre-Release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.tag.outputs.value }}
RELEASE_SHA: ${{ github.event.workflow_run.head_sha }}
shell: bash
run: |
set -euo pipefail
gh release create "$RELEASE_TAG" \
build/libs/CloverChat.jar \
build/libs/CloverChat.jar.sha256 \
build/libs/CloverChat-dependencies.txt \
--repo "$GITHUB_REPOSITORY" \
--target "$RELEASE_SHA" \
--title "$RELEASE_TAG" \
--prerelease \
--generate-notes