From 8e589ed0e83eb609ffef08d5880b068646621c58 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Apr 2025 14:50:44 -0700 Subject: [PATCH 1/6] auto bump workflow --- .github/workflows/vscode-version-bump.yml | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/vscode-version-bump.yml diff --git a/.github/workflows/vscode-version-bump.yml b/.github/workflows/vscode-version-bump.yml new file mode 100644 index 000000000..4cb42e6f4 --- /dev/null +++ b/.github/workflows/vscode-version-bump.yml @@ -0,0 +1,75 @@ +name: VS Code Extension Version Bump +on: + schedule: + # Runs at 7 AM PST (15:00 UTC) every Friday + - cron: "0 15 * * 5" + workflow_dispatch: + # Allows manual triggering + +jobs: + version-bump: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Find and process version tags + run: | + # Find last v1.1.x-vscode tag that's at least 6 days old + CURRENT_TIMESTAMP=$(date +%s) + SIX_DAYS_AGO=$((CURRENT_TIMESTAMP - 6*24*60*60)) + + LAST_1_1_TAG=$(git for-each-ref --sort=-creatordate --format '%(refname:short) %(creatordate:unix)' refs/tags \ + | grep 'v1\.1\.[0-9]\+-vscode' \ + | while read tag timestamp; do + if [ $timestamp -le $SIX_DAYS_AGO ]; then + echo ${tag% *} + break + fi + done) + + if [ -z "$LAST_1_1_TAG" ]; then + echo "No suitable v1.1.x-vscode tag found" + exit 1 + fi + + # Find last v1.0.y-vscode tag + LAST_1_0_TAG=$(git tag --sort=-v:refname | grep '^v1\.0\.[0-9]\+-vscode' | head -n1) + if [ -z "$LAST_1_0_TAG" ]; then + echo "No v1.0.y-vscode tag found" + exit 1 + fi + + # Extract the y number and increment it + Y_NUMBER=$(echo $LAST_1_0_TAG | sed 's/v1\.0\.\([0-9]\+\)-vscode/\1/') + NEXT_Y=$((Y_NUMBER + 1)) + NEW_BRANCH="v1.0.${NEXT_Y}-vscode" + NEW_VERSION="1.0.${NEXT_Y}" + + # Create new branch from the v1.1.x tag + git checkout $LAST_1_1_TAG + git checkout -b $NEW_BRANCH + + # Update the version in package.json + jq ".version = \"$NEW_VERSION\"" extensions/vscode/package.json > temp.json && mv temp.json extensions/vscode/package.json + + # Configure git + git config user.name "GitHub Actions Bot" + git config user.email "actions@github.com" + + # Commit and push changes + git add extensions/vscode/package.json + git commit -m "Bump VS Code extension to ${NEW_VERSION}" + git push origin $NEW_BRANCH + + - name: Check for errors + if: failure() + run: | + echo "::error::Failed to process version tags and create new branch" From 735a1b658ef57a7a564fa50b3b98008054863ae5 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Apr 2025 14:51:30 -0700 Subject: [PATCH 2/6] better logging --- .github/workflows/vscode-version-bump.yml | 40 +++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/vscode-version-bump.yml b/.github/workflows/vscode-version-bump.yml index 4cb42e6f4..39dc5b7f1 100644 --- a/.github/workflows/vscode-version-bump.yml +++ b/.github/workflows/vscode-version-bump.yml @@ -22,9 +22,16 @@ jobs: - name: Find and process version tags run: | + echo "Starting version bump process..." + # Find last v1.1.x-vscode tag that's at least 6 days old CURRENT_TIMESTAMP=$(date +%s) SIX_DAYS_AGO=$((CURRENT_TIMESTAMP - 6*24*60*60)) + echo "Current timestamp: $(date -d @${CURRENT_TIMESTAMP})" + echo "Six days ago: $(date -d @${SIX_DAYS_AGO})" + + echo "Looking for v1.1.x-vscode tags..." + git for-each-ref --sort=-creatordate --format '%(refname:short) %(creatordate:iso)' refs/tags | grep 'v1\.1\.[0-9]\+-vscode' || echo "No matching tags found" LAST_1_1_TAG=$(git for-each-ref --sort=-creatordate --format '%(refname:short) %(creatordate:unix)' refs/tags \ | grep 'v1\.1\.[0-9]\+-vscode' \ @@ -35,15 +42,20 @@ jobs: fi done) + echo "Selected v1.1.x tag: $LAST_1_1_TAG" if [ -z "$LAST_1_1_TAG" ]; then - echo "No suitable v1.1.x-vscode tag found" + echo "::error::No suitable v1.1.x-vscode tag found" exit 1 fi # Find last v1.0.y-vscode tag + echo "Looking for v1.0.y-vscode tags..." + git tag --sort=-v:refname | grep '^v1\.0\.[0-9]\+-vscode' || echo "No matching tags found" + LAST_1_0_TAG=$(git tag --sort=-v:refname | grep '^v1\.0\.[0-9]\+-vscode' | head -n1) + echo "Selected v1.0.y tag: $LAST_1_0_TAG" if [ -z "$LAST_1_0_TAG" ]; then - echo "No v1.0.y-vscode tag found" + echo "::error::No v1.0.y-vscode tag found" exit 1 fi @@ -52,24 +64,48 @@ jobs: NEXT_Y=$((Y_NUMBER + 1)) NEW_BRANCH="v1.0.${NEXT_Y}-vscode" NEW_VERSION="1.0.${NEXT_Y}" + echo "Current Y number: $Y_NUMBER" + echo "Next Y number: $NEXT_Y" + echo "New branch name: $NEW_BRANCH" + echo "New version: $NEW_VERSION" # Create new branch from the v1.1.x tag + echo "Creating new branch from $LAST_1_1_TAG..." git checkout $LAST_1_1_TAG git checkout -b $NEW_BRANCH # Update the version in package.json + echo "Current package.json version:" + cat extensions/vscode/package.json | grep version + + echo "Updating version in package.json..." jq ".version = \"$NEW_VERSION\"" extensions/vscode/package.json > temp.json && mv temp.json extensions/vscode/package.json + echo "New package.json version:" + cat extensions/vscode/package.json | grep version + # Configure git + echo "Configuring git..." git config user.name "GitHub Actions Bot" git config user.email "actions@github.com" # Commit and push changes + echo "Committing changes..." git add extensions/vscode/package.json git commit -m "Bump VS Code extension to ${NEW_VERSION}" + + echo "Pushing branch to origin..." git push origin $NEW_BRANCH + echo "Version bump process completed successfully!" + - name: Check for errors if: failure() run: | echo "::error::Failed to process version tags and create new branch" + echo "Last few lines of git log:" + git log -n 5 --oneline + echo "Current git status:" + git status + echo "Current branches:" + git branch -a From 9593e9326d1ad81b49e805d6a9b8dfe0c5b5a1b0 Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Apr 2025 14:57:11 -0700 Subject: [PATCH 3/6] automatically bump pre-release version after pre-release --- .github/workflows/preview.yaml | 39 +++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 7408cf76f..80eaa4931 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,4 +1,4 @@ -name: Publish Preview Extension +name: Publish Pre-release Extension on: release: @@ -207,6 +207,7 @@ jobs: if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' permissions: contents: write + pull-requests: write steps: # 0. Setup git - name: Checkout @@ -242,12 +243,44 @@ jobs: cd extensions/vscode npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix - # 4. Update the package.json version and push changes + # 4. Create PR with version bump + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Create PR branch + run: | + BRANCH_NAME="chore/bump-vscode-version-$(date +%Y%m%d-%H%M%S)" + git checkout -b $BRANCH_NAME + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + + - name: Bump version in package.json + run: | + cd extensions/vscode + npm version patch --no-git-tag-version + VERSION=$(node -p "require('./package.json').version") + echo "NEW_VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.CI_GITHUB_TOKEN }} + commit-message: "chore: bump vscode extension version to ${{ env.NEW_VERSION }}" + title: "chore: bump vscode extension version to ${{ env.NEW_VERSION }}" + body: | + Automated PR to bump the VS Code extension version after successful pre-release publication. + + - Bumped version in extensions/vscode/package.json to ${{ env.NEW_VERSION }} + branch: ${{ env.BRANCH_NAME }} + base: main + delete-branch: true + + # 5. Update version in package.json # - name: Update version in package.json # run: | # cd extensions/vscode # npm version patch - # - name: Commit changes # run: | # git config --local user.email "action@github.com" From 2a3331db4886687cec48f4e8aa2056b52a0ca0cf Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Apr 2025 15:23:57 -0700 Subject: [PATCH 4/6] auto-release workflow --- .github/workflows/auto-release.yml | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/auto-release.yml diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 000000000..11589da2a --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,52 @@ +name: Create Automatic Release + +on: + schedule: + - cron: "0 17 * * *" # Run at 9am PST (17:00 UTC) every day + workflow_dispatch: # Keep manual trigger option + +jobs: + create-release: + runs-on: ubuntu-latest + permissions: + contents: write # Needed for creating releases + + 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 + 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" + echo "New version will be: $new_version" + echo "NEW_VERSION=$new_version" >> $GITHUB_ENV + + - name: Create Release + env: + GH_TOKEN: ${{ github.token }} + run: | + # Create a new draft release with auto-generated release notes + gh release create "$NEW_VERSION" \ + --generate-notes \ + --title "$NEW_VERSION" \ + --draft \ + --latest From 9cb7977d27373d81c3d053e753e7231cb36f9faa Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Apr 2025 15:24:26 -0700 Subject: [PATCH 5/6] fix cron --- .github/workflows/auto-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 11589da2a..98eabb0da 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -2,7 +2,7 @@ name: Create Automatic Release on: schedule: - - cron: "0 17 * * *" # Run at 9am PST (17:00 UTC) every day + - cron: "0 17 * * 1,3,5" # Run at 9am PST (17:00 UTC) on Monday, Wednesday, Friday workflow_dispatch: # Keep manual trigger option jobs: From 10b801f6409624e47a788667a4ecee82700c559e Mon Sep 17 00:00:00 2001 From: Nate Date: Sat, 5 Apr 2025 15:28:01 -0700 Subject: [PATCH 6/6] create jetbrains draft release --- .github/workflows/auto-release.yml | 49 +++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index 98eabb0da..5985624de 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: # Keep manual trigger option jobs: - create-release: + create-vscode-release: runs-on: ubuntu-latest permissions: contents: write # Needed for creating releases @@ -50,3 +50,50 @@ jobs: --title "$NEW_VERSION" \ --draft \ --latest + --prerelease + + create-jetbrains-release: + runs-on: ubuntu-latest + permissions: + contents: write # Needed for creating releases + + 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 -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" + echo "New version will be: $new_version" + echo "NEW_VERSION=$new_version" >> $GITHUB_ENV + + - name: Create Release + env: + GH_TOKEN: ${{ github.token }} + run: | + # Create a new draft release with auto-generated release notes + gh release create "$NEW_VERSION" \ + --generate-notes \ + --title "$NEW_VERSION" \ + --draft \ + --latest + --prerelease