From 4592607ca74807e85b179ad3f5236a62c08a256e Mon Sep 17 00:00:00 2001 From: Anton Kosyakov Date: Tue, 21 Mar 2023 21:50:13 +0100 Subject: [PATCH] [jb] allow to auto update platform for next EAP (#16951) --- ...brains-update-plugin-platform-template.yml | 44 ++++++++----------- .../jetbrains-update-plugin-platform.yml | 9 ++-- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/.github/workflows/jetbrains-update-plugin-platform-template.yml b/.github/workflows/jetbrains-update-plugin-platform-template.yml index 01e6db5f728441..9f5f2fa79b939d 100644 --- a/.github/workflows/jetbrains-update-plugin-platform-template.yml +++ b/.github/workflows/jetbrains-update-plugin-platform-template.yml @@ -9,8 +9,12 @@ on: description: ID of the plugin in lowercase and without spaces. type: string required: true - xpath: - description: Xpath for the latest platform version in https://www.jetbrains.com/intellij-repository/snapshots + productCode: + description: JB Product Code + type: string + required: true + productType: + description: JB Product Type type: string required: true gradlePropertiesPath: @@ -26,41 +30,29 @@ jobs: update-plugin-platform: name: Update Platform Version from ${{ inputs.pluginName }} runs-on: ubuntu-latest - env: - SNAPSHOTS_HTML_FILENAME: snapshots.html steps: - name: Checkout Repository uses: actions/checkout@v3 - - name: Save the snapshots page to an HTML file - run: curl -sL https://www.jetbrains.com/intellij-repository/snapshots > ${{ env.SNAPSHOTS_HTML_FILENAME }} - name: Get Current Platform Version id: current-version run: | CURRENT_VERSION=$(cat ${{ inputs.gradlePropertiesPath }} | grep platformVersion= | sed 's/platformVersion=//') + echo "Current platform version: $CURRENT_VERSION" echo "::set-output name=result::$CURRENT_VERSION" - - name: Extract Major Version from Current Platform Version - id: major-version - run: | - MAJOR_VERSION=$(cut -c 1-3 <<< ${{ steps.current-version.outputs.result }}) - echo "Major Version from Current Platform Version: $MAJOR_VERSION" - echo "::set-output name=result::$MAJOR_VERSION" - - name: Replace Major Version Placeholder - id: update-xpath - run: | - UPDATED_XPATH=$(echo "${{ inputs.xpath }}" | sed 's/MAJOR_VERSION_PLACEHOLDER/${{ steps.major-version.outputs.result }}/') - echo "Updated xpath: $UPDATED_XPATH" - echo "::set-output name=result::$UPDATED_XPATH" - name: Get Latest Platform Version - uses: QwerMike/xpath-action@v1 id: latest-version - with: - filename: ${{ env.SNAPSHOTS_HTML_FILENAME }} - expression: ${{ steps.update-xpath.outputs.result }} - - run: rm ${{ env.SNAPSHOTS_HTML_FILENAME }} - - name: Print Result run: | - echo "Current platform version: ${{ steps.current-version.outputs.result }}" - echo "Latest platform version: ${{ steps.latest-version.outputs.result }}" + URL="https://data.services.jetbrains.com/products/releases?code=${{ inputs.productCode }}&type=${{ inputs.productType }}&platform=linux" + echo "URL: $URL" + BUILD=$(curl -s "$URL" |jq -r ".${{ inputs.productCode }}[0].build") + echo "BUILD: $BUILD" + MAJOR=$(cut -d. -f1 <<< $BUILD) + echo "MAJOR: $MAJOR" + MINOR=$(cut -d. -f2 <<< $BUILD) + echo "MINOR: $MINOR" + LATEST_VERSION="$MAJOR.$MINOR-EAP-CANDIDATE-SNAPSHOT" + echo "Latest platform version: $LATEST_VERSION" + echo "::set-output name=result::$LATEST_VERSION" - name: Update ${{ inputs.gradlePropertiesPath }} if: ${{ steps.latest-version.outputs.result != steps.current-version.outputs.result }} run: | diff --git a/.github/workflows/jetbrains-update-plugin-platform.yml b/.github/workflows/jetbrains-update-plugin-platform.yml index 7544a5e4d0ecf3..ff39e7bf7b3d58 100644 --- a/.github/workflows/jetbrains-update-plugin-platform.yml +++ b/.github/workflows/jetbrains-update-plugin-platform.yml @@ -10,7 +10,8 @@ jobs: with: pluginName: JetBrains Backend Plugin (EAP) pluginId: latest-backend-plugin - xpath: "(/html/body/table[preceding::h2/text()='com.jetbrains.intellij.idea'][1]/tbody/tr/td[contains(text(),'-EAP-CANDIDATE-SNAPSHOT') and starts-with(text(),'MAJOR_VERSION_PLACEHOLDER')]/text())[1]" + productCode: IIU + productType: eap,rc,release gradlePropertiesPath: components/ide/jetbrains/backend-plugin/gradle-latest.properties secrets: slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }} @@ -20,7 +21,8 @@ jobs: with: pluginName: JetBrains Gateway Plugin (EAP) pluginId: latest-gateway-plugin - xpath: "(/html/body/table[preceding::h2/text()='com.jetbrains.gateway'][1]/tbody/tr/td[contains(text(),'-CUSTOM-SNAPSHOT') and starts-with(text(),'MAJOR_VERSION_PLACEHOLDER') and not(contains(text(),'-NIGHTLY'))]/text())[1]" + productCode: GW + productType: eap,rc,release gradlePropertiesPath: components/ide/jetbrains/gateway-plugin/gradle-latest.properties secrets: slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }} @@ -30,7 +32,8 @@ jobs: with: pluginName: JetBrains Gateway Plugin (Stable) pluginId: stable-gateway-plugin - xpath: "(/html/body/table[preceding::h2/text()='com.jetbrains.gateway'][1]/tbody/tr/td[contains(text(),'-CUSTOM-SNAPSHOT') and starts-with(text(),'MAJOR_VERSION_PLACEHOLDER') and not(contains(text(),'-NIGHTLY'))]/text())[1]" + productCode: GW + productType: release gradlePropertiesPath: components/ide/jetbrains/gateway-plugin/gradle-stable.properties secrets: slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }}