Skip to content

Automated bump to 2.0.0 #1

Automated bump to 2.0.0

Automated bump to 2.0.0 #1

name: Release and Publish
on:
push:
tags:
- 'v*' # Triggers the workflow when a new version tag (e.g., v1.0.0) is pushed.
branches:
- 'master'
workflow_dispatch:
inputs:
version_type:
description: 'Specify version bump type'
required: false
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Update Version
id: update_version
run: |
npm version ${{ github.event.inputs.version_type || 'patch' }} -m "Automated bump to %s"
new_version=$(node -p "require('./package.json').version")
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- name: Build Project
run: npm run build
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ steps.update_version.outputs.new_version }}"
name: "Release v${{ steps.update_version.outputs.new_version }}"
body: |
Automated release of version v${{ steps.update_version.outputs.new_version }}.
- name: Upload Plugin Files
uses: actions/upload-artifact@v2
with:
name: insta-toc-${{ steps.update_version.outputs.new_version }}
path: |
manifest.json
main.js
styles.css