Update tmbundle workflow #14
This file contains hidden or 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: Build VSCode extension | |
| on: | |
| push: | |
| paths: | |
| - 'plush.tmbundle/**' | |
| - '.github/workflows/tmbundle.yml' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: '>=20.x.x' | |
| - name: Install vsce | |
| run: npm install -g @vscode/vsce | |
| - name: Bump Version | |
| run: | | |
| cd plush.tmbundle | |
| if [ ! -f package.json ]; then | |
| echo "Error: package.json not found in plush.tmbundle" | |
| exit 1 | |
| fi | |
| # Get new version number | |
| OLD_VERSION=$(jq -r '.version' package.json) | |
| echo "Current version: $OLD_VERSION" | |
| # Update package version number | |
| npm version patch --no-git-tag-version | |
| # Get new version number | |
| NEW_VERSION=$(jq -r '.version' package.json) | |
| echo "New version: $NEW_VERSION" | |
| # Create a commit that updates the version number | |
| git config --global user.name "VSIX extension update workflow" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add package.json | |
| if [ -f package-lock.json ]; then | |
| git add package-lock.json | |
| fi | |
| git commit -m "Bump version to $NEW_VERSION [skip ci]" || echo "No changes to commit" | |
| git push | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Build .vsix package | |
| run: cd plush.tmbundle && vsce package | |
| - name: Extract version and set tag | |
| run: | | |
| VERSION=$(jq -r '.version' plush.tmbundle/package.json) | |
| echo "TAG=vsix-$VERSION" >> $GITHUB_ENV | |
| - name: Delete Existing Release (if any) | |
| run: | | |
| if gh release view ${{ env.TAG }} --repo ${{ github.repository }} > /dev/null 2>&1; then | |
| echo "Release with tag ${{ env.TAG }} exists, deleting it..." | |
| gh release delete ${{ env.TAG }} --repo ${{ github.repository }} --yes | |
| else | |
| echo "No release with tag ${{ env.TAG }} exists, proceeding..." | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Create Release | |
| run: | | |
| VERSION=$(jq -r '.version' plush.tmbundle/package.json) | |
| gh release create ${{ env.TAG }} 'plush.tmbundle/*.vsix' --title "Plush VSCode Extension $VERSION" --generate-notes | |
| env: | |
| GH_TOKEN: ${{ github.token }} |