Skip to content

Release and Publish #159

Release and Publish

Release and Publish #159

name: Release and Publish
on:
pull_request:
branches:
- master
types:
- closed
workflow_dispatch:
inputs:
version_type:
description: 'Specify version bump type'
required: false
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
jobs:
release:
if: |
github.event_name == 'workflow_dispatch' || (
github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == 'master'
)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Remove Tag Prefix
run: npm config set tag-version-prefix ""
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Install dependencies
run: npm ci
- name: Get Version
id: get_version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- 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/[email protected]
with:
tag_name: "${{ env.VERSION }}"
name: "${{ env.VERSION }}"
body: |
Automated release of version ${{ env.VERSION }}.
files: |
manifest.json
main.js
styles.css
- name: Upload Plugin Files
uses: actions/[email protected]
with:
name: insta-toc-${{ env.VERSION }}
path: |
manifest.json
main.js
styles.css