-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a Nightly GitHub Action that updates the Platform Version f…
…rom JetBrains Plugins
- Loading branch information
Showing
2 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
130 changes: 130 additions & 0 deletions
130
.github/workflows/jetbrains-update-plugin-platform-template.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
pluginName: | ||
description: Name of the plugin. | ||
type: string | ||
required: true | ||
pluginId: | ||
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 | ||
type: string | ||
required: true | ||
gradlePropertiesPath: | ||
description: Path for the gradle.properties file of the plugin. | ||
type: string | ||
required: true | ||
secrets: | ||
slackWebhook: | ||
required: true | ||
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 "::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 }}" | ||
- name: Update ${{ inputs.gradlePropertiesPath }} | ||
if: ${{ steps.latest-version.outputs.result != steps.current-version.outputs.result }} | ||
run: | | ||
sed -i 's/platformVersion=${{ steps.current-version.outputs.result }}/platformVersion=${{ steps.latest-version.outputs.result }}/' ${{ inputs.gradlePropertiesPath }} | ||
git diff | ||
- name: Create Pull Request for Gateway Plugin | ||
if: ${{ inputs.pluginId == 'gateway-plugin' && steps.latest-version.outputs.result != steps.current-version.outputs.result }} | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
title: "Update Platform Version from ${{ inputs.pluginName }}" | ||
body: | | ||
## Description | ||
This PR updates the Platform Version from ${{ inputs.pluginName }} to the latest version. | ||
## How to test | ||
1. Ensure you have the [latest JetBrains Gateway](https://www.jetbrains.com/remote-development/gateway/) installed. | ||
2. Download the plugin build related to this branch in [Dev Versions](https://plugins.jetbrains.com/plugin/18438-gitpod-gateway/versions/dev), and install it on the Gateway following [these instructions](https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk). | ||
3. Change the "Gitpod Host" (in JetBrains Gateway Preferences >> Tools >> Gitpod) to the preview environment hostname, so you can see the list of workspaces running on it. | ||
4. Create a new workspace from JetBrains Gateway (it's ok to use the pre-selected IDE and Repository) and confirm if JetBrains Client can connect to it. | ||
## Release Notes | ||
```release-note | ||
NONE | ||
``` | ||
## Werft options: | ||
- [ ] /werft with-preview | ||
_This PR was created automatically with GitHub Actions using [this](https://github.com/gitpod-io/gitpod/blob/main/.github/workflows/jetbrains-update-plugin-platform-template.yml) template._ | ||
commit-message: "Update Platform Version of ${{ inputs.pluginName }} to ${{ steps.latest-version.outputs.version }}" | ||
branch: "jetbrains/update-${{ inputs.pluginId }}-platform-version-to-${{ steps.latest-version.outputs.version }}" | ||
labels: "team: IDE" | ||
team-reviewers: "engineering-ide" | ||
- name: Create Pull Request for Backend Plugin | ||
if: ${{ inputs.pluginId == 'backend-plugin' && steps.latest-version.outputs.result != steps.current-version.outputs.result }} | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
title: "Update Platform Version from ${{ inputs.pluginName }}" | ||
body: | | ||
## Description | ||
This PR updates the Platform Version from ${{ inputs.pluginName }} to the latest version. | ||
## How to test | ||
1. Open the preview environment generated for this branch | ||
2. Choose the stable version of IntelliJ IDEA as your preferred editor | ||
3. Start a workspace using this repository: https://github.com/gitpod-io/spring-petclinic | ||
4. Verify that the workspace starts successfully | ||
5. Verify that the IDE opens successfully | ||
## Release Notes | ||
```release-note | ||
NONE | ||
``` | ||
## Werft options: | ||
- [x] /werft with-preview | ||
_This PR was created automatically with GitHub Actions using [this](https://github.com/gitpod-io/gitpod/blob/main/.github/workflows/jetbrains-update-plugin-platform-template.yml) template._ | ||
commit-message: "Update Platform Version of ${{ inputs.pluginName }} to ${{ steps.latest-version.outputs.version }}" | ||
branch: "jetbrains/update-${{ inputs.pluginId }}-platform-version-to-${{ steps.latest-version.outputs.version }}" | ||
labels: "team: IDE" | ||
team-reviewers: "engineering-ide" | ||
- name: Slack Notification | ||
if: always() | ||
uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_WEBHOOK: ${{ secrets.slackWebhook }} | ||
SLACK_COLOR: ${{ job.status }} | ||
SLACK_TITLE: ${{ inputs.productName }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: JB Plugins Platform Update | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# At 11:00 on every day-of-week from Monday through Friday. | ||
- cron: "0 11 * * 1-5" | ||
jobs: | ||
update-backend-plugin-platform: | ||
uses: ./.github/workflows/jetbrains-update-plugin-platform-template.yml | ||
with: | ||
pluginName: JetBrains Backend Plugin | ||
pluginId: 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]" | ||
gradlePropertiesPath: components/ide/jetbrains/backend-plugin/gradle-latest.properties | ||
secrets: | ||
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }} | ||
update-gateway-plugin-platform: | ||
uses: ./.github/workflows/jetbrains-update-plugin-platform-template.yml | ||
with: | ||
pluginName: JetBrains Gateway Plugin | ||
pluginId: 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]" | ||
gradlePropertiesPath: components/ide/jetbrains/gateway-plugin/gradle.properties | ||
secrets: | ||
slackWebhook: ${{ secrets.IDE_SLACK_WEBHOOK }} |