Skip to content

Commit

Permalink
Add publish.yml and build.yml workflows and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
bitspittle committed Mar 2, 2024
1 parent dbce3fb commit 8462368
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.
10 changes: 5 additions & 5 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.")
}
}
}

0 comments on commit 8462368

Please sign in to comment.