From 6cd64864443bb46894748a0649fc6cb814da0a6f Mon Sep 17 00:00:00 2001 From: Daniel Biehl Date: Sun, 29 Dec 2024 13:39:13 +0100 Subject: [PATCH] chore: integrate intellij plugin in package workflow --- .../workflows/build-test-package-publish.yml | 44 +++++++++++++++++++ cliff.toml | 2 +- pyproject.toml | 1 + scripts/package.py | 3 ++ scripts/update_git_versions.py | 7 +++ 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-package-publish.yml b/.github/workflows/build-test-package-publish.yml index 2e1977979..b0b22f86f 100644 --- a/.github/workflows/build-test-package-publish.yml +++ b/.github/workflows/build-test-package-publish.yml @@ -149,6 +149,30 @@ jobs: cache: "npm" cache-dependency-path: package-lock.json + # Validate wrapper + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 21 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-home-cache-cleanup: true + + # Set environment variables + - name: Export Properties + id: properties + shell: bash + run: | + echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT + - name: install node modules run: npm install --also=dev @@ -160,6 +184,9 @@ jobs: if: ${{ startsWith( github.ref, 'refs/tags/v') }} run: hatch run build:update-doc-links + - name: Update Changelog + run: hatch run build:git-cliff -o CHANGELOG.md + - name: package run: hatch run build:package @@ -181,6 +208,23 @@ jobs: name: wheel-package path: dist/*.whl + - name: Prepare IntelliJ Plugin Artifact + id: artifact + shell: bash + run: | + cd ${{ github.workspace }}/intellij-client/build/distributions + FILENAME=`ls *.zip` + unzip "$FILENAME" -d content + + echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT + + # Store already-built plugin as an artifact for downloading + - name: Upload IntelliJ plugin + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./intellij-client/build/distributions/content/*/* + publish: runs-on: ubuntu-latest needs: package diff --git a/cliff.toml b/cliff.toml index 10b4e0372..56cf6b928 100644 --- a/cliff.toml +++ b/cliff.toml @@ -21,7 +21,7 @@ body = """ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} {% endif %}\ {% else %}\ - ## [unreleased] + ## [Unreleased] {% endif %}\ {% for group, commits in commits | group_by(attribute="group") %} ### {{ group | upper_first }} diff --git a/pyproject.toml b/pyproject.toml index 82e8b0ce2..5429e494d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -251,6 +251,7 @@ exclude = [ "^playground/", "^scripts/", "^bundled/libs/", + "^intellij-client/", ] mypy_path = [ "typings", diff --git a/scripts/package.py b/scripts/package.py index 116bcbabe..d0e61e021 100644 --- a/scripts/package.py +++ b/scripts/package.py @@ -58,6 +58,9 @@ def main() -> None: check=False, ).check_returncode() + shutil.rmtree("./intellij-client/build", ignore_errors=True) + run("gradlew buildPlugin --console=plain", shell=True, check=False, cwd="intellij-client").check_returncode() + if __name__ == "__main__": main() diff --git a/scripts/update_git_versions.py b/scripts/update_git_versions.py index 5814591e0..a03f5a51a 100644 --- a/scripts/update_git_versions.py +++ b/scripts/update_git_versions.py @@ -73,6 +73,13 @@ def main() -> None: rf"\g<1>{version or ''}\g<3>", ) + for f in [Path("intellij-client/gradle.properties")]: + replace_in_file( + f, + re.compile(r"""(^pluginVersion\s*=\s*)([0-9]+\S*)""", re.MULTILINE), + rf"\g<1>{version or ''}", + ) + if __name__ == "__main__": main()