From 84623689a6aa33815803d2a5cb211c8996eda9e1 Mon Sep 17 00:00:00 2001 From: David Herman Date: Fri, 1 Mar 2024 16:27:44 -0800 Subject: [PATCH] Add publish.yml and build.yml workflows and update README --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 30 +++++++++++++++++++++++++++ README.md | 7 ++++++- plugin/build.gradle.kts | 10 ++++----- 4 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9e83265 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build Kobweb IntelliJ Plugin + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Add secret Gradle properties + env: + GRADLE_PROPERTIES: ${{ secrets.KOBWEB_IJ_PLUGIN_GRADLE_PROPERTIES }} + run: | + mkdir -p ~/.gradle/ + echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV + echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties + + - name: Publish Kobweb IntelliJ Plugin + run: ./gradlew :plugin:signPlugin --scan + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: kobweb-ij-plugin + path: plugin/build/distributions/plugin-*-signed.zip + if-no-files-found: error + retention-days: 1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..66cfa8e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish Kobweb IntelliJ Plugin + +on: + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Add secret Gradle properties + env: + GRADLE_PROPERTIES: ${{ secrets.KOBWEB_IJ_PLUGIN_GRADLE_PROPERTIES }} + run: | + mkdir -p ~/.gradle/ + echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV + echo "${GRADLE_PROPERTIES}" > ~/.gradle/gradle.properties + + - name: Publish Kobweb IntelliJ Plugin + run: ./gradlew :plugin:buildPlugin # :plugin:publishPlugin --scan diff --git a/README.md b/README.md index 877b639..2d36cca 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,10 @@ instructions [here](https://www.jetbrains.com/help/idea/managing-plugins.html#in ## Publishing +The Gradle task associated with publishing a plugin is `:plugin:publishPlugin`. + Publishing the plugin requires either credentials be set on your local machine *or* by using the project's GitHub -publish action, as the credentials have been installed into the repository as a secret. +publish action (preferred), as the credentials have been installed into the repository as a secret. Before publishing, you should make sure you've reviewed the following checklist: @@ -71,3 +73,6 @@ Before publishing, you should make sure you've reviewed the following checklist: * The `patchPlugin.untilBuild` property still encompasses the latest EAP version. * The [CHANGELOG.md](CHANGELOG.md) file has been updated with the new version and its changes. * You've tested the plugin locally by running `:plugin:buildPlugin` and installing it from disk. +* You've created a release on https://github.com/varabyte/kobweb-intellij-plugin + * The version should have the pattern "vX.Y.Z". + * The "What's New" section in the plugin UI links to commits associated with the tag created by the release. diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index a2fe5b6..1c47f91 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -92,16 +92,16 @@ tasks { } if (!credentialsFound) { - logger.info("Credentials not found. The plugin cannot be signed on this machine.") + logger.lifecycle("Signing credentials not found. The plugin cannot be signed on this machine.") } else { - logger.info("Credentials found. The plugin can be signed on this machine.") + logger.lifecycle("Signing credentials found. The plugin can be signed on this machine.") } } run { var tokenFound = false publishPlugin { - val token = (findProperty("kobweb.intellij.plugin.token") as? String) ?: return@publishPlugin + val token = (findProperty("kobweb.intellij.plugin.publish.token") as? String) ?: return@publishPlugin tokenFound = true this.token = token @@ -111,9 +111,9 @@ tasks { } if (!tokenFound) { - logger.info("Credentials not found. The plugin cannot be published from this machine.") + logger.lifecycle("Publishing credentials not found. The plugin cannot be published from this machine.") } else { - logger.info("Credentials found. The plugin can be published from this machine.") + logger.lifecycle("Publishing credentials found. The plugin can be published from this machine.") } } }