From 9e550752b3dcc9fd464443caf4c75db95532180f Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 23 Sep 2024 15:41:52 -0800 Subject: [PATCH] [toolbox] Build in CI The rest (publishing) is a todo. --- .github/workflows/build.yml | 90 +++++++++-------------------------- .github/workflows/release.yml | 53 ++------------------- 2 files changed, 28 insertions(+), 115 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b20b90ea..fa0bc7034 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,68 +66,22 @@ jobs: java-version: 17 cache: gradle - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - PROPERTIES="$(./gradlew properties --console=plain -q)" - VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" - NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')" - CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" - CHANGELOG="${CHANGELOG//'%'/'%25'}" - CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" - CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" - echo "::set-output name=version::$VERSION" - echo "::set-output name=name::$NAME" - echo "::set-output name=changelog::$CHANGELOG" - echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier" - ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier - # Run plugin build - name: Run Build - run: ./gradlew clean buildPlugin --info - -# until https://github.com/JetBrains/gradle-intellij-plugin/issues/1027 is solved - -# # Cache Plugin Verifier IDEs -# - name: Setup Plugin Verifier IDEs Cache -# uses: actions/cache@v2.1.7 -# with: -# path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides -# key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} -# -# # Run Verify Plugin task and IntelliJ Plugin Verifier tool -# - name: Run Plugin Verification tasks -# run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }} -# -# # Collect Plugin Verifier Result -# - name: Collect Plugin Verifier Result -# if: ${{ always() }} -# uses: actions/upload-artifact@v4 -# with: -# name: pluginVerifier-result -# path: ${{ github.workspace }}/build/reports/pluginVerifier + run: ./gradlew clean build --info # Run Qodana inspections - name: Qodana - Code Inspection uses: JetBrains/qodana-action@v2023.3.2 - # Prepare plugin archive content for creating artifact - - name: Prepare Plugin Artifact - id: artifact - shell: bash - run: | - cd ${{ github.workspace }}/build/distributions - FILENAME=`ls *.zip` - unzip "$FILENAME" -d content - echo "::set-output name=filename::${FILENAME:0:-4}" # Store already-built plugin as an artifact for downloading - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./build/distributions/content/*/* + # TODO: Need a modified copyPlugin task or something like that to copy all + # the required jar files. + #- name: Upload artifact + # uses: actions/upload-artifact@v4 + # with: + # name: ${{ steps.artifact.outputs.filename }} + # path: ./build/distributions/content/*/* # Prepare a draft release for GitHub Releases page for the manual verification # If accepted and published, release workflow would be triggered @@ -142,24 +96,26 @@ jobs: - name: Fetch Sources uses: actions/checkout@v4.1.7 + # TODO: If we keep the two plugins in the same repository, we need a way + # to differentiate the tags and releases. # Remove old release drafts by using the curl request for the available releases with draft flag - name: Remove Old Release Drafts env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh api repos/{owner}/{repo}/releases \ - --jq '.[] | select(.draft == true) | .id' \ - | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} + run: echo "Not implemented" ; exit 1 #| + #gh api repos/{owner}/{repo}/releases \ + # --jq '.[] | select(.draft == true) | .id' \ + # | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} # Create new release draft - which is not publicly visible and requires manual acceptance - name: Create Release Draft env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create v${{ needs.build.outputs.version }} \ - --draft \ - --target ${GITHUB_REF_NAME} \ - --title "v${{ needs.build.outputs.version }}" \ - --notes "$(cat << 'EOM' - ${{ needs.build.outputs.changelog }} - EOM - )" + run: echo "Not implemented" ; exit 1 #| + #gh release create v${{ needs.build.outputs.version }} \ + # --draft \ + # --target ${GITHUB_REF_NAME} \ + # --title "v${{ needs.build.outputs.version }}" \ + # --notes "$(cat << 'EOM' + #${{ needs.build.outputs.changelog }} + #EOM + #)" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f5355a9c..021da5f69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,63 +27,20 @@ jobs: java-version: 17 cache: gradle - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' - ${{ github.event.release.body }} - EOM - )" - - CHANGELOG="${CHANGELOG//'%'/'%25'}" - CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" - CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" - - echo "::set-output name=changelog::$CHANGELOG" - - # Update Unreleased section with the current release note - - name: Patch Changelog - if: ${{ steps.properties.outputs.changelog != '' }} - env: - CHANGELOG: ${{ steps.properties.outputs.changelog }} - run: | - ./gradlew patchChangelog --release-note="$CHANGELOG" - # Publish the plugin to the Marketplace + # TODO@JB: Not sure if Toolbox will go to the same marketplace. - name: Publish Plugin env: PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} - run: ./gradlew publishPlugin --info + run: echo "Not implemented" ; exit 1 #./gradlew publishPlugin --info # Upload artifact as a release asset + # TODO: Need a modified copyPlugin task or something like that to copy all + # the required jar files. - name: Upload Release Asset env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* - - # Create pull request - - name: Create Pull Request - if: ${{ steps.properties.outputs.changelog != '' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION="${{ github.event.release.tag_name }}" - BRANCH="changelog-update-$VERSION" - - git config user.email "action@github.com" - git config user.name "GitHub Action" - - git checkout -b $BRANCH - git commit -am "Changelog update - $VERSION" - git push --set-upstream origin $BRANCH - - gh pr create \ - --title "Changelog update - \`$VERSION\`" \ - --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ - --base main \ - --head $BRANCH \ No newline at end of file + run: echo "Not implemented" ; exit 1 #gh release upload ${{ github.event.release.tag_name }} ./build/distributions/*