Skip to content

Testing bump version, pr, merge, and draft release. #10

Testing bump version, pr, merge, and draft release.

Testing bump version, pr, merge, and draft release. #10

Workflow file for this run

name: Testing bump version, pr, merge, and draft release.
# Allow manual triggers
on:
workflow_dispatch:
inputs:
release_type:
description: "Release type: minor or major (default: patch)"
required: false
default: "patch" # Default to patch if not provided
permissions:
contents: write
pull-requests: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout repository
uses: actions/checkout@v4
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# Step 3: Install dependencies
- name: Install dependencies
run: npm install
# Step 4: Install vsce CLI globally
- name: Install vsce CLI
run: npm install -g @vscode/vsce
# Step 5: Verify the VSCE_TOKEN
- name: Test the VSCE_TOKEN
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
run: |
vsce verify-pat -p ${VSCE_PAT}
echo ${{ github.event.inputs.release_type }}
# Step 6: Publish and get new version number
#- name: Publish to VS Code Marketplace
# id: publish
# env:
# VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# BRANCH_NAME="vsce-version-bump" # Initial branch name before bump
# git checkout -b $BRANCH_NAME
# vsce publish ${{ github.event.inputs.release_type }} -p ${VSCE_PAT}
# NEW_VERSION=$(grep -m1 -Eo "([0-9]+\.[0-9]+\.[0-9]+)" package.json)
# BRANCH_NAME=vsce-version-bump-${NEW_VERSION}
# git branch -m $BRANCH_NAME
# git push --set-upstream origin $BRANCH_NAME
# echo "new_version=$NEW_VERSION" >> $GITHUB_ENV
# Step 7: Package the extension to a .vsix file
- name: Package extension
run: vsce package
# Step 8: Upload the packaged .vsix file as an artifact
#- name: Upload .vsix as artifact
# uses: actions/upload-artifact@v4
# with:
# name: eetasks-${new_version}
# path: "*.vsix"
# Step 9: Create and merge pull request with the commit made by vsce
#- name: Update repository
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# BRANCH_NAME="vsce-version-bump-${{ env.new_version }}"
# git checkout $BRANCH_NAME
# gh pr create --title "Version bump to ${{ env.new_version}}" --body "Version bump to ${{ env.new_version }}" --base main --head $BRANCH_NAME
# gh pr merge --admin --merge --delete-branch --auto
# Step 10: Draft a GitHub release
- name: Draft GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ env.new_version }}"
release_name: "v${{ env.new_version }}"
body: "Eetasks version v${{ env.new_version }}."
draft: true
prerelease: false
files: "*.vsix"