Skip to content

Commit

Permalink
Add Experimental channel
Browse files Browse the repository at this point in the history
  • Loading branch information
mkondratek committed Aug 7, 2024
1 parent bfeafca commit d8ef718
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 17 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/experimental-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Experimental Release
on:
push:
tags: [ "*-experimental" ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle
# See note about QEMU and binfmt requirement here https://github.com/vercel/pkg#targets
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v3
- run: yarn global add [email protected]
- run: |
echo "RELEASE_VERSION=$(./scripts/version-from-git-tag.sh)" >> $GITHUB_ENV
- run: echo "Publishing version $RELEASE_VERSION"
- name: Publish experimental version
run: |
echo "Publishing experimental version ${RELEASE_VERSION}-experimental"
./gradlew "-PpluginVersion=${RELEASE_VERSION}-experimental" publishPlugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Nightly Release
on:
push:
tags: [ "*" ]
tags: [ "*-nightly" ]
jobs:
publish:
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ You should build everything in PowerShell. Git Bash, Ubuntu and MinGW all offer
$env:SKIP_CODE_SEARCH_BUILD="true"
```

## Using Nightly channel releases
## Using Nightly/Experimental channel releases

- Open "Sourcegraph & Cody" settings
- Change to "Nightly" update channel
- Change to "Nightly"/"Experimental" update channel
- Open "Plugins"
- Update Sourcegraph plugin
- Restart IDE
Expand Down Expand Up @@ -168,17 +168,17 @@ We trigger the stable channel release only after the nightly channel release pas

```mermaid
graph TD;
Title --> nightly["Nightly Release"];
Title --> nightly["Nightly Release / Experimental Release"];
Title["JetBrains Plugin Release"] --> stable["Stable Release"];
stable --> trigger_stable["Manually trigger 'Stable Release' workflow\nin GitHub Actions"];
release_stable --> marketplace_approval["Wait for JetBrains approval"];
marketplace_approval --> |Automated approval, up to 48hr| unhide["unhide"];
unhide --> available_to_end_users_stable["Available for download"];
marketplace_approval --> |Manual quick-approve| slack_approval["Request JetBrains Marketplace team\nto manually approve it via Slack"];
slack_approval --> unhide["Unhide the approved release\n(requires admin access)"];
nightly --> push_nightly["Run `push-git-tag-for-next-release.sh`"];
nightly --> push_tag["Run `push-git-tag-for-next-release.sh`"];
trigger_stable --> release_stable["Wait for 'Stable Release' workflow to complete"];
push_nightly --> release_nightly["Wait for 'Nightly Release' workflow to complete"];
push_tag --> release_nightly["Wait for 'Nightly Release' / 'Experimental Release'\nworkflow to complete"];
release_nightly --> available_to_end_users_nightly["Available for download"];
```

Expand Down
20 changes: 13 additions & 7 deletions scripts/push-git-tag-for-next-release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Run this script to cut a new nightly release.
# Run this script to cut a new release.
# No arguments needed, the version is automatically computed.
set -eux

Expand All @@ -8,7 +8,7 @@ CURRENT_BRANCH=$(git symbolic-ref --short HEAD)
if [ "$CURRENT_BRANCH" != "main" ]; then
echo "Warning: You are not on the 'main' branch. You are on '$CURRENT_BRANCH'."
# shellcheck disable=SC2162
read -p "Are you sure you want to proceed? (y/n): " proceed
read -p "Are you sure you want to proceed? (y/N): " proceed
if [ "$proceed" != "y" ]; then
echo "Aborted."
exit 1
Expand All @@ -22,8 +22,14 @@ if ! git diff-index --quiet HEAD --; then
fi

# Check the number of arguments
if [ "$#" -ne 1 ]; then
echo "Usage: $0 [--major | --minor | --patch]"
if [ "$#" -ne 2 ]; then
echo "Usage: $0 [--major | --minor | --patch] [ --nightly | --experimental ]"
exit 1
fi

CHANNEL="${2#--}"
if [ "$CHANNEL" != "nightly" ] && [ "$CHANNEL" != "experimental" ]; then
echo "Invalid argument. Usage: $0 [--major | --minor | --patch] [ --nightly | --experimental ]"
exit 1
fi

Expand All @@ -34,15 +40,15 @@ NEXT_VERSION="$(bash "$SCRIPT_DIR/next-release.sh" $NEXT_RELEASE_ARG)"

# Check the argument and take appropriate action
if [ "$NEXT_RELEASE_ARG" == "--major" ]; then
read -p "[WARNING] Upgrade of the major version in a special event, do you want to proceed? (y/n): " choice
read -p "[WARNING] Upgrade of the major version in a special event, do you want to proceed? (y/N): " choice
if [ "$choice" != "y" ]; then
echo "Aborted."
exit 1
fi
fi

# shellcheck disable=SC2162
read -p "Confirm that you want to run the release v$NEXT_VERSION (y/n): " choice
read -p "Confirm that you want to run the release v$NEXT_VERSION-$CHANNEL (y/N): " choice
if [ "$choice" == "y" ]; then
echo "Running release..."
else
Expand All @@ -51,6 +57,6 @@ else
fi

bash "$SCRIPT_DIR/verify-release.sh"
TAG="v$NEXT_VERSION"
TAG="v$NEXT_VERSION-$CHANNEL"
echo "$TAG"
git tag -a "$TAG" -m "$TAG" && git push origin "$TAG"
6 changes: 3 additions & 3 deletions scripts/version-from-git-tag.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -eu
VERSION="$(git describe --tags | sed 's/^v//')"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-nightly)?$ ]]; then
VERSION="$(git describe --tags | sed 's/^v//' | sed 's/-nightly//' | sed 's/-experimental//')"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version $VERSION does not match semver pattern MAJOR.MINOR.PATCH where each part is a number"
echo "To fix this problem, make sure you are running this script with a non-dirty work tree and that HEAD points to a commit that has an associated git tag using the format vMAJOR.MINOR.PATCH"
exit 1
fi
echo $VERSION
echo $VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import com.intellij.util.ui.PresentableEnum

enum class UpdateChannel(val channelUrl: String?) : PresentableEnum {
Stable(null as String?),
Nightly("https://plugins.jetbrains.com/plugins/nightly/9682");
Nightly("https://plugins.jetbrains.com/plugins/nightly/9682"),
Experimental("https://plugins.jetbrains.com/plugins/experimental/9682");

override fun getPresentableText(): String {
return when (this) {
Stable -> "Stable"
Nightly -> "Nightly"
Experimental -> "Experimental"
}
}
}

0 comments on commit d8ef718

Please sign in to comment.