Skip to content

Commit

Permalink
[jb] allow to auto update platform for next EAP (#16951)
Browse files Browse the repository at this point in the history
  • Loading branch information
akosyakov authored Mar 21, 2023
1 parent f51a377 commit 4592607
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 deletions.
44 changes: 18 additions & 26 deletions .github/workflows/jetbrains-update-plugin-platform-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: |
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/jetbrains-update-plugin-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand Down

0 comments on commit 4592607

Please sign in to comment.