Skip to content

chore: bump version to 1.4.0-beta.1 #13

chore: bump version to 1.4.0-beta.1

chore: bump version to 1.4.0-beta.1 #13

name: Create Release from package.json
on:
push:
branches:
- master
paths:
- 'package.json'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch all history so conventional-changelog-action can read all commits
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Get version from package.json
id: get_version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Generate changelog
id: changelog
uses: TriPSs/conventional-changelog-action@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
output-file: false
# Prevent the action from creating commits or tags
skip-commit: true
skip-tag: true
skip-version-file: true
skip-bump: true
- name: Check for pre-release tag in version
id: check_prerelease
run: |
if [[ "${{ steps.get_version.outputs.version }}" == *alpha* || "${{ steps.get_version.outputs.version }}" == *beta* ]]; then
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
# Use the exact version from package.json for the tag and release name
tag_name: "v${{ steps.get_version.outputs.version }}"
name: "v${{ steps.get_version.outputs.version }}"
# Use the generated changelog text as the release body
body: ${{ steps.changelog.outputs.changelog }}
# Correctly mark as pre-release based on the version from package.json
prerelease: ${{ steps.check_prerelease.outputs.is_prerelease }}