我有一个我编写的 IntelliJ 插件的 GitHub 存储库。我想要一个运行
./gradlew build
并在推送时上传工件的工作流程。
这是我目前拥有的:
name: Make ZIP file
on:
push:
jobs:
make-zip:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
-
name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build
-
name: Upload ZIP
uses: actions/upload-artifact@v4
with:
name: zip
path: build/distributions/*
这是错误:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'project'.
> Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
> Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=JETBRAINS, implementation=vendor-specific} for LINUX on x86_64.
> No locally installed toolchains match and toolchain download repositories have not been configured.
我明白了:我的插件需要 JetBrainsRuntime,但尚未安装。问题是 Setup Java 不支持该发行版。
我该如何进行这项工作?我不想为每个提交都发布一个版本,并且 ZIP 文件必须可供任何能够
read
存储库的人使用。
我发现我需要在我的
settings.gradle.kts
中添加这些行:
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}
另请参阅此问题。