-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (58 loc) · 2.01 KB
/
Copy pathbuild.yml
File metadata and controls
69 lines (58 loc) · 2.01 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
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setting up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '25'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Build
run: ./gradlew build
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: liquidbounce-scriptapi
path: build/libs/*.jar
- name: Publish snapshot release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
JAR=$(find build/libs -name '*.jar' -not -name '*-sources.jar' | head -n1)
[ -n "$JAR" ] || { echo "[ERROR] no jar in build/libs" >&2; exit 1; }
NOTES="Automatic build of \`${GITHUB_SHA::7}\` from \`main\`.
Not a stable release - it tracks whatever is on main right now."
# Recreate rather than edit: `gh release upload --clobber` cannot retarget the tag when
# main has moved on.
gh release delete snapshot --cleanup-tag --yes || true
gh release create snapshot "$JAR" \
--title "Snapshot" \
--notes "$NOTES" \
--prerelease \
--target "$GITHUB_SHA"
- name: Attach jar to release
if: github.event_name == 'release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
JAR=$(find build/libs -name '*.jar' -not -name '*-sources.jar' | head -n1)
[ -n "$JAR" ] || { echo "[ERROR] no jar in build/libs" >&2; exit 1; }
gh release upload "${{ github.event.release.tag_name }}" "$JAR" --clobber