diff --git a/.github/actions/sign-and-verify-intellij-plugin/action.yml b/.github/actions/sign-and-verify-intellij-plugin/action.yml deleted file mode 100644 index fae99fec..00000000 --- a/.github/actions/sign-and-verify-intellij-plugin/action.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: 'Sign and Verify IntelliJ Plugin' -description: 'A composite actions for signing and verifying IntelliJ plugins.' - -inputs: - GITHUB_TOKEN: - description: 'GitHub token' - required: true - -runs: - using: 'composite' - steps: - - name: Build signed plugin - shell: bash - run: ./gradlew signPlugin - - name: Verify IntelliJ plugin - # https://www.jetbrains.com/idea/download/other.html - uses: ChrisCarini/intellij-platform-plugin-verifier-action@v2.0.2 - env: - GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} - with: - plugin-location: idea-plugin/build/distributions/*-signed.zip - ide-versions: | - ideaIC:2024.1 - ideaIC:2024.1.1 - ideaIC:2024.1.2 - ideaIC:2024.1.3 - ideaIC:2024.1.4 - ideaIC:LATEST-EAP-SNAPSHOT - failure-levels: | - COMPATIBILITY_WARNINGS - COMPATIBILITY_PROBLEMS - DEPRECATED_API_USAGES - INTERNAL_API_USAGES - OVERRIDE_ONLY_API_USAGES - NON_EXTENDABLE_API_USAGES - PLUGIN_STRUCTURE_WARNINGS - MISSING_DEPENDENCIES - INVALID_PLUGIN - NOT_DYNAMIC diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 17925517..75df8736 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,13 +13,11 @@ jobs: env: CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} - outputs: - version: ${{ steps.properties.outputs.artifactName }} - steps: - uses: actions/checkout@v4 @@ -33,46 +31,52 @@ jobs: with: gradle-home-cache-cleanup: true - - name: Setup properties - id: properties - shell: bash + - name: Prepare release name run: | - NAME=$(grep "^pluginName=" plugin.properties | cut -d '=' -f 2) - VERSION=$(grep "^version=" plugin.properties | cut -d '=' -f 2) - - echo "NAME=$NAME" - echo "VERSION=$VERSION" + PLUGIN_NAME=$(grep "^PLUGIN_NAME=" gradle.properties | cut -d '=' -f 2) + VERSION=$(grep "^VERSION_NAME=" gradle.properties | cut -d '=' -f 2) + + if [[ $VERSION == *-SNAPSHOT ]]; then + RELEASE_NAME="Nightly" + else + RELEASE_NAME=$PLUGIN_NAME-$VERSION + fi + + echo "RELEASE_NAME=$RELEASE_NAME" + echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV - echo "name=$NAME" >> $GITHUB_ENV - echo "version=$VERSION" >> $GITHUB_ENV - echo "artifactName=$NAME-$VERSION" >> $GITHUB_ENV + - name: Build signed plugin + run: ./gradlew signPlugin - - name: Sign and Verify IntelliJ Plugin - uses: ./.github/actions/sign-and-verify-intellij-plugin + - name: Verify IntelliJ plugin + # https://www.jetbrains.com/idea/download/other.html + uses: ChrisCarini/intellij-platform-plugin-verifier-action@v2.0.1 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + plugin-location: idea-plugin/build/distributions/*-signed.zip + ide-versions: | + ideaIC:2024.1 + ideaIC:2024.1.1 + ideaIC:2024.1.2 + ideaIC:2024.1.3 + ideaIC:2024.1.4 + ideaIC:LATEST-EAP-SNAPSHOT + failure-levels: | + COMPATIBILITY_WARNINGS + COMPATIBILITY_PROBLEMS + DEPRECATED_API_USAGES + INTERNAL_API_USAGES + OVERRIDE_ONLY_API_USAGES + NON_EXTENDABLE_API_USAGES + PLUGIN_STRUCTURE_WARNINGS + MISSING_DEPENDENCIES + INVALID_PLUGIN + NOT_DYNAMIC - name: Publish to Marketplace + if: env.RELEASE_NAME != 'Nightly' run: ./gradlew publishPlugin - - name: Remove old drafts - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Delete release if exist then create a new one run: | - gh api repos/{owner}/{repo}/releases \ - --jq '.[] | select(.draft == true) | .id' \ - | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} - - - name: Create draft - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create ${{ env.artifactName }} \ - --draft \ - --title "${{ env.artifactName }}" \ - --notes "" - - - name: Upload release asset - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release upload ${{ env.artifactName }} ./idea-plugin/build/distributions/*-signed.zip + gh release view env.RELEASE_NAME && gh release delete env.RELEASE_NAME -y --cleanup-tag + gh release create env.RELEASE_NAME idea-plugin/build/distributions/*-signed.zip -p --generate-notes diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 8239776d..5e17f6fc 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -30,34 +30,3 @@ jobs: - name: Run build run: ./gradlew build - - nightly-release: - runs-on: ubuntu-latest - needs: build - if: github.repository == 'ComposeGears/Valkyrie' && github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 17 - - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - name: Sign and Verify IntelliJ Plugin - uses: ./.github/actions/sign-and-verify-intellij-plugin - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - env: - CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} - - name: Delete release if exist then create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release view "Nightly" && gh release delete "Nightly" -y --cleanup-tag - gh release create "Nightly" idea-plugin/build/distributions/*-signed.zip -p --generate-notes diff --git a/build.gradle.kts b/build.gradle.kts index 2b9a355b..3d8e55db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,6 +9,9 @@ plugins { } allprojects { + group = rootProject.providers.gradleProperty("GROUP").get() + version = rootProject.providers.gradleProperty("VERSION_NAME").get() + plugins.apply(rootProject.libs.plugins.spotless.get().pluginId) extensions.configure { kotlin { diff --git a/gradle.properties b/gradle.properties index 2823530d..590163c7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,3 +6,8 @@ org.gradle.parallel=true # https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library kotlin.stdlib.default.dependency=false kotlin.code.style=official + + +GROUP=io.github.composegears +VERSION_NAME=0.4.2-SNAPSHOT +PLUGIN_NAME=Valkyrie diff --git a/idea-plugin/build.gradle.kts b/idea-plugin/build.gradle.kts index 5e6fd3df..c3faff98 100644 --- a/idea-plugin/build.gradle.kts +++ b/idea-plugin/build.gradle.kts @@ -1,6 +1,5 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.jetbrains.kotlin.konan.properties.Properties plugins { alias(libs.plugins.kotlin.jvm) @@ -9,13 +8,6 @@ plugins { alias(libs.plugins.jetbrains.intellij) } -val pluginProperties = Properties().apply { - load(file("$rootDir/plugin.properties").reader()) -} - -group = "io.github.composegears" -version = pluginProperties.getProperty("version") - // https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#configuration.repositories repositories { google { diff --git a/plugin.properties b/plugin.properties deleted file mode 100644 index f553800b..00000000 --- a/plugin.properties +++ /dev/null @@ -1,2 +0,0 @@ -pluginName=Valkyrie -version=0.4.2-SNAPHOT