diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 5985624dec..43d65d5b5f 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -1,6 +1,9 @@ name: Create Automatic Release on: + push: + branches: + - nate/auto-main-release-draft schedule: - cron: "0 17 * * 1,3,5" # Run at 9am PST (17:00 UTC) on Monday, Wednesday, Friday workflow_dispatch: # Keep manual trigger option @@ -13,30 +16,13 @@ jobs: steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Important for getting all tags and commits - - - name: Get latest tag - id: get_latest_tag - run: | - # Get the latest tag ending in -vscode or default to v1.1.0-vscode if none exists - latest_tag=$(git tag --sort=-creatordate | grep -E "-vscode$" | head -n 1 || echo "v1.1.0-vscode") - echo "Latest tag: $latest_tag" - echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV - - name: Generate next version - id: generate_version + - name: Get version from package.json + id: get_version run: | - # Extract version numbers (handle the -vscode suffix) - version=${LATEST_TAG#v} # Remove v prefix - version=${version%-vscode} # Remove -vscode suffix - IFS='.' read -ra VERSION_PARTS <<< "$version" - - # Increment patch version - ((VERSION_PARTS[2]++)) - - # Create new version string with -vscode suffix - new_version="v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}-vscode" + # Read version from package.json and add -vscode suffix + version=$(node -p "require('./extensions/vscode/package.json').version") + new_version="v${version}-vscode" echo "New version will be: $new_version" echo "NEW_VERSION=$new_version" >> $GITHUB_ENV @@ -49,7 +35,7 @@ jobs: --generate-notes \ --title "$NEW_VERSION" \ --draft \ - --latest + --latest \ --prerelease create-jetbrains-release: @@ -60,29 +46,14 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 # Important for getting all tags and commits + fetch-depth: 0 - - name: Get latest tag - id: get_latest_tag + - name: Get version from gradle.properties + id: get_version run: | - # Get the latest tag ending in -jetbrains or default to v1.1.0-jetbrains if none exists - latest_tag=$(git tag --sort=-creatordate | grep -E "-jetbrains$" | head -n 1 || echo "v1.1.0-jetbrains") - echo "Latest tag: $latest_tag" - echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV - - - name: Generate next version - id: generate_version - run: | - # Extract version numbers (handle the -jetbrains suffix) - version=${LATEST_TAG#v} # Remove v prefix - version=${version%-jetbrains} # Remove -jetbrains suffix - IFS='.' read -ra VERSION_PARTS <<< "$version" - - # Increment patch version - ((VERSION_PARTS[2]++)) - - # Create new version string with -jetbrains suffix - new_version="v${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}-jetbrains" + # Read version from gradle.properties and add -jetbrains suffix + version=$(grep '^pluginVersion=' extensions/intellij/gradle.properties | cut -d'=' -f2) + new_version="v${version}-jetbrains" echo "New version will be: $new_version" echo "NEW_VERSION=$new_version" >> $GITHUB_ENV @@ -95,5 +66,5 @@ jobs: --generate-notes \ --title "$NEW_VERSION" \ --draft \ - --latest + --latest \ --prerelease diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index a968dcc19b..058d6191b7 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -37,6 +37,52 @@ jobs: echo "should_run=false" >> $GITHUB_OUTPUT fi + bump-version: + runs-on: ubuntu-latest + needs: + - check_release_name + if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' + permissions: + contents: write + pull-requests: write + steps: + # 0. Setup git + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Git + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + - name: Create PR branch + run: | + BRANCH_NAME="chore/bump-jetbrains-version-$(date +%Y%m%d-%H%M%S)" + git checkout -b $BRANCH_NAME + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + + - name: Bump version in gradle.properties + run: | + cd extensions/intelllij + awk '/pluginVersion=/{split($0,a,"="); split(a[2],b,"."); b[3]+=1; printf "%s=%s.%s.%s\n",a[1],b[1],b[2],b[3];next}1' gradle.properties > tmp && mv tmp gradle.properties + rm -rf tmp + NEW_VERSION=$(grep 'pluginVersion=' gradle.properties | cut -d'=' -f2) + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.CI_GITHUB_TOKEN }} + commit-message: "chore: bump jetbrains extension version to ${{ env.NEW_VERSION }}" + title: "chore: bump jetbrains extension version to ${{ env.NEW_VERSION }}" + body: | + Automated PR to bump the JetBrains extension version after successful pre-release publication. + + - Bumped version in extensions/intellij/gradle.properties to ${{ env.NEW_VERSION }} + branch: ${{ env.BRANCH_NAME }} + base: main + delete-branch: true + # Prepare and publish the plugin to JetBrains Marketplace repository build: needs: check_release_name diff --git a/.github/workflows/vscode-version-bump.yml b/.github/workflows/vscode-version-bump.yml index 39dc5b7f17..c05da185f2 100644 --- a/.github/workflows/vscode-version-bump.yml +++ b/.github/workflows/vscode-version-bump.yml @@ -1,4 +1,4 @@ -name: VS Code Extension Version Bump +name: Create VS Code main release draft on: schedule: # Runs at 7 AM PST (15:00 UTC) every Friday @@ -15,6 +15,10 @@ jobs: with: fetch-depth: 0 # Fetch all history and tags + - name: Setup GitHub CLI + run: | + gh auth login --with-token <<< "${{ github.token }}" + - name: Use Node.js from .nvmrc uses: actions/setup-node@v4 with: @@ -97,6 +101,15 @@ jobs: echo "Pushing branch to origin..." git push origin $NEW_BRANCH + # Add release creation + echo "Creating draft release..." + gh release create "${NEW_BRANCH}" \ + --title "${NEW_BRANCH}" \ + --generate-notes \ + --draft \ + --latest \ + --notes-start-tag "${LAST_1_0_TAG}" + echo "Version bump process completed successfully!" - name: Check for errors