Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize release workflow #57

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/actions/sign-and-verify-intellij-plugin/action.yml

This file was deleted.

78 changes: 41 additions & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
egorikftp marked this conversation as resolved.
Show resolved Hide resolved
31 changes: 0 additions & 31 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpotlessExtension> {
kotlin {
Expand Down
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 0 additions & 8 deletions idea-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions plugin.properties

This file was deleted.