Draft release #17
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
name: Draft release | |
on: | |
workflow_dispatch: | |
inputs: | |
versionBump: | |
description: 'Version bump' | |
type: choice | |
required: true | |
default: 'patch' | |
options: | |
- patch | |
- minor | |
- major | |
- exact-version | |
exactVersion: | |
description: 'Exact version: (Only effective selecting "exact-version" as version bump)' | |
required: false | |
permissions: | |
contents: write | |
jobs: | |
prepare-release: | |
name: "Prepare Release" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Determine Next Version | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -e | |
VERSION_BUMP=${{ github.event.inputs.versionBump }} | |
if [[ "$VERSION_BUMP" == "major" || "$VERSION_BUMP" == "minor" || "$VERSION_BUMP" == "patch" ]]; then | |
./gradlew --quiet --console=plain versionBump -Pmode="$VERSION_BUMP" | |
else | |
./gradlew --quiet --console=plain versionBump -PexactVersion="${{ github.event.inputs.exactVersion }}" | |
fi | |
NEXT_VERSION=$(./gradlew --quiet --console=plain getVersion) | |
echo "RELEASE_TAG=v${NEXT_VERSION}" >> "$GITHUB_ENV" | |
- name: Validate release tag | |
shell: bash | |
run: | | |
if [ -z "${RELEASE_TAG}" ]; then | |
echo "RELEASE_TAG is not set or is empty" | |
exit 1 | |
fi | |
if git rev-parse "$RELEASE_TAG" >/dev/null 2>&1; then | |
echo "Error: Tag $RELEASE_TAG already existing" | |
echo "If you are trying to re-create a draft release with this version, please delete the release and the tag first." | |
echo "If this version has already been release consider using a different one." | |
exit 1 | |
fi | |
- name: Setup Docker (for Test Containers) | |
run: | | |
sudo apt update -y | |
sudo apt install -y docker docker-compose | |
- name: Run Unit and Integration Tests | |
run: | | |
./gradlew "unitTest" ":packages:jetbrains-plugin:test" | |
- name: Prepare License Key | |
env: | |
JB_TEST_KEY: ${{ secrets.JB_TEST_KEY }} | |
run: | | |
mkdir -p packages/jetbrains-plugin/build/idea-sandbox/config-uiTest | |
echo "$JB_TEST_KEY" | base64 -d > packages/jetbrains-plugin/build/idea-sandbox/config-uiTest/idea.key | |
- name: Start UI Test Environment | |
run: | | |
export DISPLAY=:99.0 | |
Xvfb -ac :99 -screen 0 1920x1080x24 & | |
sleep 10 | |
mkdir -p packages/jetbrains-plugin/build/reports | |
./gradlew :packages:jetbrains-plugin:runIdeForUiTests > packages/jetbrains-plugin/build/reports/idea.log & | |
IDEA_PID=$! | |
echo $IDEA_PID > idea.pid | |
- name: Wait for IDE to start | |
uses: jtalk/url-health-check-action@v3 | |
with: | |
url: "http://127.0.0.1:8082" | |
max-attempts: 15 | |
retry-delay: 30s | |
- name: Run UI Tests | |
uses: nick-fields/retry@v3 | |
env: | |
DISPLAY: ":99.0" | |
with: | |
timeout_minutes: 30 | |
max_attempts: 3 | |
command: ./gradlew --quiet --console=plain :packages:jetbrains-plugin:uiTest | |
- name: Stop IDEA | |
run: | | |
IDEA_PID=$(cat idea.pid) | |
kill -9 $IDEA_PID | |
- name: Patch Plugin XML | |
run: | | |
./gradlew ":packages:jetbrains-plugin:patchPluginXml" | |
- name: Verify Plugin | |
run: | | |
./gradlew ":packages:jetbrains-plugin:verifyPlugin" | |
- name: Sign and Publish Plugin in Beta | |
env: | |
JB_PUBLISH_CHANNEL: "beta" | |
JB_PUBLISH_TOKEN: ${{ secrets.JB_PUBLISH_TOKEN }} | |
JB_CERTIFICATE_CHAIN: ${{ secrets.JB_CERTIFICATE_CHAIN }} | |
JB_PRIVATE_KEY: ${{ secrets.JB_PRIVATE_KEY }} | |
JB_PRIVATE_KEY_PASSWORD: ${{ secrets.JB_PRIVATE_KEY_PASSWORD }} | |
run: | | |
./gradlew ":packages:jetbrains-plugin:publishPlugin" | |
- name: Patch Changelog | |
run: | | |
./gradlew ":packages:jetbrains-plugin:patchChangelog" | |
- name: Create Draft Release | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.SVC_DEVTOOLSBOT_TOKEN }} | |
run: | | |
set -e | |
echo Creating draft release for: "${RELEASE_TAG}" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit --no-verify -m "Release ${RELEASE_TAG}" | |
git tag ${RELEASE_TAG} | |
git push origin ${RELEASE_TAG} | |
GIT_REF=$(git rev-parse ${RELEASE_TAG}) | |
ls packages/jetbrains-plugin/build/distributions/jetbrains-plugin.zip | |
CHANGELOG=$(./gradlew --quiet --console=plain :packages:jetbrains-plugin:getChangelog) | |
gh release create "${RELEASE_TAG}" \ | |
--title "${RELEASE_TAG}" \ | |
--notes "${CHANGELOG}" \ | |
--target "${GIT_REF}" \ | |
--draft \ | |
packages/jetbrains-plugin/build/distributions/jetbrains-plugin.zip | |