-
Notifications
You must be signed in to change notification settings - Fork 119
103 lines (86 loc) · 3.6 KB
/
gradle.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
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
name: "Build"
on:
push:
branches: [ "**" ]
tags-ignore: [ "**" ]
pull_request:
workflow_dispatch:
merge_group:
concurrency:
cancel-in-progress: true
group: build-${{ github.event.pull_request.number || github.ref }}
jobs:
build:
runs-on: ubuntu-latest
name: Build and publish
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v4
with:
java-version: 23
check-latest: true
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary: always
cache-cleanup: on-success
cache-read-only: ${{ github.ref != 'refs/heads/nightly' }}
- name: Setup Loom cache
uses: actions/cache@v4
with:
path: '.gradle/loom-cache'
restore-keys: ${{ runner.os }}-gradle-loom-
key: ${{ runner.os }}-gradle-loom-${{ hashFiles('gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties') }}
- name: Execute build and tests
run: ./gradlew build test shadowJar genUpdaterInformation --stacktrace
- name: Publish test summary
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }}
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "**/build/test-results/test/TEST-*.xml"
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
- name: Publish updater metadata
uses: s0/git-publish-subdir-action@develop
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/renovate/') && !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }}
env:
REPO: [email protected]:CloudNetService/launchermeta.git
BRANCH: ${{ steps.branch-name.outputs.current_branch }}
FOLDER: '.launchermeta'
SQUASH_HISTORY: true
SKIP_EMPTY_COMMITS: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
MESSAGE: 'Update launcher meta for {target-branch} (commit: {sha})'
- name: Set version type in GitHub environment
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Publish snapshot to Sonatype
if: ${{ github.event_name == 'push' && env.STATUS != 'release' && startsWith(github.ref, 'refs/heads/nightly') && !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }}
run: ./gradlew publish
env:
SONATYPE_USER: "${{ secrets.SONATYPE_USER }}"
SONATYPE_TOKEN: "${{ secrets.SONATYPE_TOKEN }}"
- name: Prepare artifacts zip
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }}
run: |
mkdir -p temp/;
mkdir -p temp/plugins;
cp -r .template/* temp/;
cp LICENSE temp/license.txt;
cp launcher/java22/build/libs/launcher.jar temp/launcher.jar;
find plugins/ -type f -regex '.*/build/libs/.*\.jar' ! -name '*-javadoc.jar' ! -name '*-sources.jar' -exec cp {} temp/plugins \;
- name: Upload artifacts zip
uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/gh-readonly-queue/') }}
with:
name: CloudNet
path: temp/