Skip to content

Commit e2b7d62

Browse files
committed
👷 更新CI
1 parent d9410ac commit e2b7d62

3 files changed

Lines changed: 76 additions & 56 deletions

File tree

.github/workflows/buildPlugin.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
1-
name: BuildPlugin
1+
name: Build Plugin
22

33
on:
44
push:
55
branches-ignore:
66
- 'private*'
77
paths:
8-
- 'loader/'
8+
- 'loader/**'
99
- 'build.gradle.kts'
1010
pull_request:
1111
paths:
12-
- 'loader/'
12+
- 'loader/**'
1313
- 'build.gradle.kts'
1414
workflow_dispatch:
1515

1616
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1717
jobs:
18-
# This workflow contains a single job called "build"
1918
build:
20-
# The type of runner that the job will run on
2119
runs-on: ubuntu-latest
2220

23-
# Steps represent a sequence of tasks that will be executed as part of the job
2421
steps:
25-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26-
- uses: actions/checkout@v4
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
2724

28-
- uses: actions/cache@v4
25+
- name: Validate Gradle wrapper
26+
uses: gradle/actions/wrapper-validation@v4
27+
28+
- name: Setup Java
29+
uses: actions/setup-java@v4
30+
with:
31+
distribution: 'temurin'
32+
java-version: '21'
33+
34+
- name: Setup Gradle
35+
uses: gradle/actions/setup-gradle@v4
2936
with:
30-
path: |
31-
~/.gradle/caches
32-
~/.gradle/wrapper
33-
key: deps-${{ hashFiles('build.gradle.kts', '**/gradle-wrapper.properties') }}
34-
restore-keys: |
35-
deps-
36-
37-
# Runs a single command using the runners shell
38-
- name: Run gradle buildPlugin
37+
cache-read-only: ${{ startsWith(github.ref, 'refs/tags/') }}
38+
39+
- name: Build plugin
3940
run: ./gradlew buildPlugin
40-
41-
- name: Upload a Build Artifact
41+
42+
- name: Upload build artifact
4243
uses: actions/upload-artifact@v4
4344
with:
44-
name: ScriptAgent-beta-${{github.run_num}}.jar
45-
path: build/libs
45+
name: ScriptAgent-beta-${{ github.run_number }}.jar
46+
path: build/libs/*.jar
47+
if-no-files-found: error
48+
retention-days: 30

.github/workflows/checkScripts.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CheckScript
1+
name: Check Scripts
22

33
on:
44
push:
@@ -9,25 +9,30 @@ on:
99

1010
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1111
jobs:
12-
# This workflow contains a single job called "build"
1312
build:
14-
# The type of runner that the job will run on
1513
runs-on: ubuntu-latest
1614

17-
# Steps represent a sequence of tasks that will be executed as part of the job
1815
steps:
19-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20-
- uses: actions/checkout@v4
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
2118
with:
2219
submodules: recursive
23-
- uses: actions/cache@v4
20+
21+
- name: Validate Gradle wrapper
22+
uses: gradle/actions/wrapper-validation@v4
23+
24+
- name: Setup Java
25+
uses: actions/setup-java@v4
2426
with:
25-
path: |
26-
~/.gradle/caches
27-
~/.gradle/wrapper
28-
key: deps-${{ hashFiles('build.gradle.kts', '**/gradle-wrapper.properties') }}
29-
restore-keys: |
30-
deps-
27+
distribution: 'temurin'
28+
java-version: '21'
29+
30+
- name: Setup Gradle
31+
uses: gradle/actions/setup-gradle@v4
32+
with:
33+
cache-read-only: ${{ startsWith(github.ref, 'refs/tags/') }}
34+
35+
# 保留自定义缓存(如果需要)
3136
- uses: actions/cache@v4
3237
with:
3338
path: libs
@@ -43,8 +48,7 @@ jobs:
4348
scripts/cache
4449
key: kts-cache-${{ steps.date.outputs.date }}
4550
restore-keys: |
46-
kts-cache
51+
kts-cache-
4752
48-
# Runs a single command using the runners shell
49-
- name: Run gradle build
50-
run: ./gradlew precompile
53+
- name: Run precompile
54+
run: ./gradlew precompile

.github/workflows/release.yml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,60 @@ on:
66
- 'v*'
77
workflow_dispatch:
88

9+
permissions:
10+
contents: write # 需要写权限来创建 release
11+
912
jobs:
10-
Release:
13+
release:
1114
runs-on: ubuntu-latest
1215

1316
steps:
14-
- uses: actions/checkout@v4
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
1519
with:
1620
submodules: recursive
17-
- uses: oven-sh/setup-bun@v2
21+
22+
- name: Setup Bun
23+
uses: oven-sh/setup-bun@v2
1824
with:
1925
bun-version: latest
20-
- name: Generate Changelog
26+
27+
- name: Generate changelog
2128
id: changelog
2229
run: bun run .github/actions/changelog.ts
2330
env:
2431
INPUT_TOKEN: ${{ github.token }}
2532

26-
- uses: actions/cache@v4
33+
- name: Validate Gradle wrapper
34+
uses: gradle/actions/wrapper-validation@v4
35+
36+
- name: Setup Java
37+
uses: actions/setup-java@v4
2738
with:
28-
path: |
29-
~/.gradle/caches
30-
~/.gradle/wrapper
31-
key: deps-${{ hashFiles('build.gradle.kts', '**/gradle-wrapper.properties') }}
32-
restore-keys: |
33-
deps-
34-
- uses: actions/cache@v4
39+
distribution: 'temurin'
40+
java-version: '21'
41+
42+
- name: Setup Gradle
43+
uses: gradle/actions/setup-gradle@v4
44+
45+
# 保留自定义的 libs 缓存
46+
- name: Cache libs directory
47+
uses: actions/cache@v4
3548
with:
3649
path: libs
3750
key: sa-deps-${{ hashFiles('scripts/build.gradle.kts') }}
3851
restore-keys: |
3952
sa-deps-
4053
41-
- name: Run unit tests and build JAR
54+
- name: Build release artifacts
4255
run: ./gradlew buildPlugin precompileZip allInOneJar
4356

44-
- name: upload artifacts
45-
uses: softprops/action-gh-release@v1
57+
- name: Create GitHub Release
58+
uses: softprops/action-gh-release@v2
4659
with:
4760
prerelease: true
48-
name: "${{github.ref_name}}"
49-
body: ${{steps.changelog.outputs.releaseBody}}
61+
name: ${{ github.ref_name }}
62+
body: ${{ steps.changelog.outputs.releaseBody }}
5063
files: |
5164
build/distributions/*
5265
build/libs/*

0 commit comments

Comments
 (0)