Skip to content

build(deps): bump actions/setup-node from 4 to 6 #228

build(deps): bump actions/setup-node from 4 to 6

build(deps): bump actions/setup-node from 4 to 6 #228

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
release_type:
description: 'Release type (patch, minor, major)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint --if-present || echo "Linting failed but continuing"
- name: Build
run: npm run build --if-present || echo "Build script not found or build failed but continuing"
- name: Test
run: npm run test --if-present || echo "No tests found or tests failed but continuing"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
release:
needs: build-and-test
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CICD_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Bump version
id: bump_version
if: github.event_name == 'workflow_dispatch'
run: |
RELEASE_TYPE="${{ github.event.inputs.release_type }}"
npm version $RELEASE_TYPE -m "Bump version to %s [skip ci]"
echo "new_version=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
- name: Auto bump patch version
id: auto_bump
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
npm version patch -m "Bump version to %s [skip ci]"
echo "new_version=$(npm pkg get version | tr -d '"')" >> $GITHUB_OUTPUT
- name: Push changes
run: |
VERSION=$(npm pkg get version | tr -d '"')
git push
git push origin v$VERSION
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.bump_version.outputs.new_version || steps.auto_bump.outputs.new_version }}
name: Release v${{ steps.bump_version.outputs.new_version || steps.auto_bump.outputs.new_version }}
draft: false
generate_release_notes: true
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}