Skip to content

Commit

Permalink
chore: add release scripts and workflow
Browse files Browse the repository at this point in the history
- Add release scripts to package.json for versioning
- Create GitHub Actions workflow for automated releases
- Install standard-version as a dev dependency
  • Loading branch information
EvanNotFound committed Dec 2, 2024
1 parent 215506c commit 6380036
Show file tree
Hide file tree
Showing 3 changed files with 1,897 additions and 20 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

on:
workflow_dispatch:
inputs:
release-type:
description: 'Release type (major/minor/patch)'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: https://registry.npmjs.org/

- name: Git config
run: |
git config --local user.email "github-actions@github.com"
git config --local user.name "github-actions"
- name: Install dependencies
run: npm ci

- name: Merge dev into main
run: |
git checkout main
git merge origin/dev
- name: Create Release
run: npm run release:${{ github.event.inputs.release-type }}

- name: Update package-lock.json
run: npm install

- name: Commit package-lock.json if changed
run: |
VERSION=$(node -p "require('./package.json').version")
if [[ -n "$(git status --porcelain package-lock.json)" ]]; then
git add package-lock.json
git commit -m "chore: bump version to ${VERSION}"
fi
- name: Push changes
run: |
git push --follow-tags origin main
git checkout dev
git merge main
git push origin dev
Loading

0 comments on commit 6380036

Please sign in to comment.